mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-09 21:01:00 +00:00
fix warsim
This commit is contained in:
+73
-6
@@ -575,7 +575,8 @@ class Battle {
|
||||
$offhero, $hero_strenght, $deffhero,
|
||||
$DefenderID,
|
||||
$calvaryLookup, $catapultLookup, $ramsLookup,
|
||||
$dp, $cdp
|
||||
$dp, $cdp,
|
||||
$AttackerID
|
||||
);
|
||||
|
||||
$ap = $attForces['ap'];
|
||||
@@ -949,7 +950,8 @@ class Battle {
|
||||
$offhero, $hero_strenght, $deffhero,
|
||||
$DefenderID,
|
||||
$calvaryLookup, $catapultLookup, $ramsLookup,
|
||||
$dp, $cdp
|
||||
$dp, $cdp,
|
||||
$AttackerID = 0
|
||||
) {
|
||||
|
||||
global $unitsbytype;
|
||||
@@ -1086,6 +1088,39 @@ class Battle {
|
||||
$cap *= $simHero['ob'];
|
||||
|
||||
$ap += $hero_strenght;
|
||||
|
||||
/**
|
||||
* SIMULATOR: aplicam si efectele echipamentului eroului.
|
||||
*
|
||||
* Ramura reala de mai sus foloseste eroul din baza de date; aici
|
||||
* eroul e sintetic, construit din procentele introduse manual, deci
|
||||
* itemele lipseau complet si simularea dadea alt rezultat decat
|
||||
* lupta adevarata.
|
||||
*
|
||||
* Le luam de la jucatorul care ruleaza simularea: forta din arme si
|
||||
* scuturi (fight_strength), bonusul pe tipul de unitate al armei si
|
||||
* cornul de vanatoare contra Natarilor.
|
||||
*/
|
||||
if (class_exists('HeroBattleBonus') && HeroBattleBonus::enabled()) {
|
||||
global $session;
|
||||
|
||||
$simUid = isset($session->uid) ? (int) $session->uid : 0;
|
||||
|
||||
if ($simUid > 0) {
|
||||
$ap += (int) HeroBattleBonus::statBonus($simUid);
|
||||
|
||||
list($simAp, $simCap) = HeroBattleBonus::unitOffense($simUid, $Attacker, $calvaryLookup);
|
||||
$ap += $simAp;
|
||||
$cap += $simCap;
|
||||
|
||||
$simNatar = HeroBattleBonus::natarMultiplier($simUid, $DefenderID);
|
||||
|
||||
if ($simNatar > 1.0) {
|
||||
$ap *= $simNatar;
|
||||
$cap *= $simNatar;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deffhero > 0) {
|
||||
@@ -1094,6 +1129,19 @@ class Battle {
|
||||
|
||||
$dp *= $dfdhero['ob'];
|
||||
$cdp *= $dfdhero['ob'];
|
||||
|
||||
// Aceleasi iteme conteaza si cand simulezi apararea.
|
||||
if (class_exists('HeroBattleBonus') && HeroBattleBonus::enabled()) {
|
||||
global $session;
|
||||
|
||||
$simUid = isset($session->uid) ? (int) $session->uid : 0;
|
||||
|
||||
if ($simUid > 0) {
|
||||
$simDef = (int) HeroBattleBonus::unitDefense($simUid, $Attacker);
|
||||
$dp += $simDef;
|
||||
$cdp += $simDef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,11 +1153,30 @@ class Battle {
|
||||
// apararea: aceeasi functie calculeaza ambele parti, in functie de rolul
|
||||
// jucatorului in lupta.
|
||||
if (class_exists('AllianceBonus') && AllianceBonus::enabled()) {
|
||||
$metalOwner = 0;
|
||||
|
||||
if (isset($Attacker) && (int) $Attacker > 0) {
|
||||
global $database;
|
||||
$metalOwner = (int) $database->getVillageField((int) $Attacker, 'owner');
|
||||
// BUG REPARAT: aici se folosea (int) $Attacker, dar $Attacker e ARRAYUL
|
||||
// de unitati, nu un id de sat. In PHP, (int) pe un array da 1, deci se
|
||||
// citea proprietarul satului 1 - un jucator la intamplare sau nimeni.
|
||||
// Bonusul de Metalurgie nu ajungea niciodata la cine trebuie.
|
||||
//
|
||||
// Atacatorul vine acum ca parametru ($AttackerID). Daca lipseste (de
|
||||
// exemplu in simulator), cadem pe eroul atacator, care poarta si el uid-ul.
|
||||
$metalOwner = (int) $AttackerID;
|
||||
|
||||
if ($metalOwner <= 0 && !empty($atkhero['uid'])) {
|
||||
$metalOwner = (int) $atkhero['uid'];
|
||||
}
|
||||
|
||||
// SIMULATOR: nu exista nici sat atacator, nici erou din baza de date,
|
||||
// asa ca luam bonusurile aliantei jucatorului care ruleaza simularea.
|
||||
// Intr-o lupta reala $AttackerID e mereu setat, deci ramura asta nu se
|
||||
// atinge acolo.
|
||||
if ($metalOwner <= 0 && ($offhero > 0 || $deffhero > 0 || $hero_strenght > 0)) {
|
||||
global $session;
|
||||
|
||||
if (isset($session->uid)) {
|
||||
$metalOwner = (int) $session->uid;
|
||||
}
|
||||
}
|
||||
|
||||
if ($metalOwner > 0) {
|
||||
|
||||
@@ -4298,3 +4298,18 @@ tz_def('TZ_RPT_F_LOST', 'Lost');
|
||||
tz_def('TZ_HERO_REGEN_TOTAL', 'Health regeneration');
|
||||
tz_def('TZ_HERO_REGEN_BASE', 'base');
|
||||
tz_def('TZ_HERO_REGEN_ITEMS', 'from items');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// MINUNEA LUMII A NATARILOR
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
tz_def('TZ_WW_NATARS', 'Natars');
|
||||
tz_def('CONF_SERV_NATARS_WW_START_DELAY', 'Natars\' World Wonder start');
|
||||
tz_def('CONF_SERV_NATARS_WW_START_DELAY_TOOLTIP', 'How many days after the construction plans appear the Natars start building their own World Wonder. Scaled by server speed. 0 disables it.');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SIMULATOR - bonusuri proprii incluse automat
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
tz_def('TZ_WS_APPLIED', 'Automatically included in this simulation:');
|
||||
tz_def('TZ_WS_ITEM_STRENGTH', 'Equipment strength');
|
||||
tz_def('TZ_WS_ITEM_UNIT', 'Weapon bonus');
|
||||
tz_def('TZ_WS_VS_NATARS', 'Against Natars');
|
||||
|
||||
@@ -4241,3 +4241,18 @@ tz_def('TZ_RPT_F_LOST', 'Perdu');
|
||||
tz_def('TZ_HERO_REGEN_TOTAL', 'Régénération des points de vie');
|
||||
tz_def('TZ_HERO_REGEN_BASE', 'de base');
|
||||
tz_def('TZ_HERO_REGEN_ITEMS', 'des objets');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// MINUNEA LUMII A NATARILOR
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
tz_def('TZ_WW_NATARS', 'Natars');
|
||||
tz_def('CONF_SERV_NATARS_WW_START_DELAY', 'Debut de la Merveille des Natars');
|
||||
tz_def('CONF_SERV_NATARS_WW_START_DELAY_TOOLTIP', 'Combien de jours apres l\'apparition des plans de construction les Natars commencent leur propre Merveille du Monde. Ajuste selon la vitesse du serveur. 0 desactive.');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SIMULATOR - bonusuri proprii incluse automat
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
tz_def('TZ_WS_APPLIED', 'Inclus automatiquement dans cette simulation :');
|
||||
tz_def('TZ_WS_ITEM_STRENGTH', 'Force de l\'equipement');
|
||||
tz_def('TZ_WS_ITEM_UNIT', 'Bonus d\'arme');
|
||||
tz_def('TZ_WS_VS_NATARS', 'Contre les Natars');
|
||||
|
||||
@@ -4038,3 +4038,18 @@ tz_def('TZ_RPT_F_LOST', 'Pierdut');
|
||||
tz_def('TZ_HERO_REGEN_TOTAL', 'Regenerarea vietii');
|
||||
tz_def('TZ_HERO_REGEN_BASE', 'de baza');
|
||||
tz_def('TZ_HERO_REGEN_ITEMS', 'din iteme');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// MINUNEA LUMII A NATARILOR
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
tz_def('TZ_WW_NATARS', 'Natari');
|
||||
tz_def('CONF_SERV_NATARS_WW_START_DELAY', 'Pornirea Minunii Natarilor');
|
||||
tz_def('CONF_SERV_NATARS_WW_START_DELAY_TOOLTIP', 'Dupa cate zile de la aparitia planurilor incep Natarii propria Minune a Lumii. Se scaleaza cu viteza serverului. 0 dezactiveaza.');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SIMULATOR - bonusuri proprii incluse automat
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
tz_def('TZ_WS_APPLIED', 'Incluse automat in aceasta simulare:');
|
||||
tz_def('TZ_WS_ITEM_STRENGTH', 'Forta echipamentului');
|
||||
tz_def('TZ_WS_ITEM_UNIT', 'Bonus de arma');
|
||||
tz_def('TZ_WS_VS_NATARS', 'Contra Natarilor');
|
||||
|
||||
Reference in New Issue
Block a user