mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Support for damage bonus (Ciele, Luna). Creeps won't grow on first day.
This commit is contained in:
parent
112ac29fc0
commit
115b626cfd
@ -144,9 +144,9 @@
|
||||
134 4 2 1 114
|
||||
134 4 2 3 114
|
||||
135 4 2 1 115
|
||||
136 5 13 0 100
|
||||
136 5 100 13 0
|
||||
137 8 53 0 0
|
||||
138 5 15 0 50
|
||||
138 5 50 15 0
|
||||
139 8 46 0 0
|
||||
140 8 43 0 0
|
||||
141 8 47 0 0
|
||||
|
@ -1044,7 +1044,7 @@ void CGHeroInstance::initObj()
|
||||
bonus.type = Bonus::PRIMARY_SKILL;
|
||||
bonus.subtype = PrimarySkill::DEFENSE;
|
||||
break;
|
||||
case 3://damage, TODO: handle it!
|
||||
case 3:
|
||||
bonus.type = Bonus::CREATURE_DAMAGE;
|
||||
bonus.subtype = 0; //both min and max
|
||||
break;
|
||||
@ -1063,8 +1063,8 @@ void CGHeroInstance::initObj()
|
||||
break;
|
||||
case 5://spell damage bonus in percent
|
||||
bonus.type = Bonus::SPECIFIC_SPELL_DAMAGE;
|
||||
bonus.valType = Bonus::PERCENT_TO_ALL;
|
||||
bonus.additionalInfo = it->additionalinfo;
|
||||
bonus.valType = Bonus::BASE_NUMBER; // current spell system is screwed
|
||||
bonus.subtype = it->subtype; //spell id
|
||||
speciality.bonuses.push_back (bonus);
|
||||
break;
|
||||
case 6://damage bonus for bless (Adela)
|
||||
@ -2819,7 +2819,7 @@ void CGCreature::initObj()
|
||||
}
|
||||
void CGCreature::newTurn() const
|
||||
{//Works only for stacks of single type of size up to 2 millions
|
||||
if (slots.begin()->second.count < CREEP_SIZE && cb->getDate(1) == 1)
|
||||
if (slots.begin()->second.count < CREEP_SIZE && cb->getDate(1) == 1 && cb->getDate(0) > 1)
|
||||
{
|
||||
ui32 power = temppower * (100 + WEEKLY_GROWTH)/100;
|
||||
cb->setObjProperty(id, 10, std::min (power/1000 , (ui32)CREEP_SIZE)); //set new amount
|
||||
|
@ -3038,25 +3038,18 @@ ui32 BattleInfo::calculateSpellDmg( const CSpell * sp, const CGHeroInstance * ca
|
||||
ret *= 1.15f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//applying hero bonuses
|
||||
if(sp->air && caster && caster->valOfBonuses(Bonus::AIR_SPELL_DMG_PREMY) != 0)
|
||||
{
|
||||
ret *= (100.0f + caster->valOfBonuses(Bonus::AIR_SPELL_DMG_PREMY)) / 100.0f;
|
||||
}
|
||||
else if(sp->fire && caster && caster->valOfBonuses(Bonus::FIRE_SPELL_DMG_PREMY) != 0)
|
||||
{
|
||||
ret *= (100.0f + caster->valOfBonuses(Bonus::FIRE_SPELL_DMG_PREMY)) / 100.0f;
|
||||
}
|
||||
else if(sp->water && caster && caster->valOfBonuses(Bonus::WATER_SPELL_DMG_PREMY) != 0)
|
||||
{
|
||||
ret *= (100.0f + caster->valOfBonuses(Bonus::WATER_SPELL_DMG_PREMY)) / 100.0f;
|
||||
}
|
||||
else if(sp->earth && caster && caster->valOfBonuses(Bonus::EARTH_SPELL_DMG_PREMY) != 0)
|
||||
{
|
||||
ret *= (100.0f + caster->valOfBonuses(Bonus::EARTH_SPELL_DMG_PREMY)) / 100.0f;
|
||||
}
|
||||
//applying hero bonuses
|
||||
ret *= (100.f + caster->valOfBonuses(Bonus::SPELL_DAMAGE) + caster->valOfBonuses(Bonus::SPECIFIC_SPELL_DAMAGE, sp->id)) / 100.0f;
|
||||
|
||||
if(sp->air)
|
||||
ret *= (100.0f + caster->valOfBonuses(Bonus::AIR_SPELL_DMG_PREMY)) / 100.0f;
|
||||
else if(sp->fire) //only one type of bonus for Magic Arrow
|
||||
ret *= (100.0f + caster->valOfBonuses(Bonus::FIRE_SPELL_DMG_PREMY)) / 100.0f;
|
||||
else if(sp->water)
|
||||
ret *= (100.0f + caster->valOfBonuses(Bonus::WATER_SPELL_DMG_PREMY)) / 100.0f;
|
||||
else if(sp->earth)
|
||||
ret *= (100.0f + caster->valOfBonuses(Bonus::EARTH_SPELL_DMG_PREMY)) / 100.0f;
|
||||
}
|
||||
//affected creature-specific part
|
||||
if(affectedCreature)
|
||||
{
|
||||
@ -3081,14 +3074,12 @@ ui32 BattleInfo::calculateSpellDmg( const CSpell * sp, const CGHeroInstance * ca
|
||||
ret *= affectedCreature->valOfBonuses(Bonus::SPELL_DAMAGE_REDUCTION, 3);
|
||||
ret /= 100;
|
||||
}
|
||||
|
||||
//general spell dmg reduction
|
||||
if(sp->air && affectedCreature->hasBonusOfType(Bonus::SPELL_DAMAGE_REDUCTION, -1)) //air spell & protection from air
|
||||
{
|
||||
ret *= affectedCreature->valOfBonuses(Bonus::SPELL_DAMAGE_REDUCTION, -1);
|
||||
ret /= 100;
|
||||
}
|
||||
|
||||
//dmg increasing
|
||||
if( affectedCreature->hasBonusOfType(Bonus::MORE_DAMAGE_FROM_SPELL, sp->id) )
|
||||
{
|
||||
|
@ -462,7 +462,6 @@ bool CCreatureTypeLimiter::limit(const Bonus &b, const CBonusSystemNode &node) c
|
||||
|
||||
return c != creature && (!includeUpgrades || !creature->isMyUpgrade(c)); //drop bonus if it's not our creature and (we dont check upgrades or its not our upgrade)
|
||||
}
|
||||
|
||||
CCreatureTypeLimiter::CCreatureTypeLimiter(const CCreature &Creature, ui8 IncludeUpgrades /*= true*/)
|
||||
:creature(&Creature), includeUpgrades(IncludeUpgrades)
|
||||
{
|
||||
@ -472,4 +471,4 @@ CCreatureTypeLimiter::CCreatureTypeLimiter()
|
||||
{
|
||||
creature = NULL;
|
||||
includeUpgrades = false;
|
||||
}
|
||||
}
|
@ -150,7 +150,8 @@ namespace PrimarySkill
|
||||
BONUS_NAME(DARKNESS) /*val = radius */ \
|
||||
BONUS_NAME(SPECIAL_SECONDARY_SKILL) /*val = id, additionalInfo = value per level in percent*/ \
|
||||
BONUS_NAME(SPECIAL_SPELL_LEV) /*val = id, additionalInfo = value per level in percent*/\
|
||||
BONUS_NAME(SPECIFIC_SPELL_DAMAGE) /*val = id of spell, additionalInfo = value*/\
|
||||
BONUS_NAME(SPELL_DAMAGE) /*val = value*/\
|
||||
BONUS_NAME(SPECIFIC_SPELL_DAMAGE) /*subtype = id of spell, val = value*/\
|
||||
BONUS_NAME(SPECIAL_BLESS_DAMAGE) /*val = spell (bless), additionalInfo = value per level in percent*/\
|
||||
BONUS_NAME(MAXED_SPELL) /*val = id*/\
|
||||
BONUS_NAME(SPECIAL_PECULIAR_ENCHANT) /*blesses and curses with id = val dependent on unit's level, subtype = 0 or 1 for Coronius*/\
|
||||
|
Loading…
Reference in New Issue
Block a user