<attacks>
<attack attack="16" interval="1500" name="melee" skill="20"/>
</attacks>
bool Game::combatChangeHealth(Creature* attacker, Creature* target, CombatDamage& damage)
{
if (attacker->getMonster())
{
damage.primary.value *= 1.5; //base dmg
damage.secondary.value *= 1.5; //elemental dmg
}
//... rest of theoriginal method code
Editing methods in monster class might be complicated. For example the functions for subtracting health, printing the damage on screen and others related to do damage are separated. In this case I suggest you to modify the game.cpp file, find the combatChangeHealth method and add new if statement at the begining.
For example:
Code:bool Game::combatChangeHealth(Creature* attacker, Creature* target, CombatDamage& damage) { if (attacker->getMonster()) { damage.primary.value *= 1.5; //base dmg damage.secondary.value *= 1.5; //elemental dmg } //... rest of theoriginal method code
This will increase monster damage to 150%.
bool Game::combatChangeHealth(Creature* attacker, Creature* target, CombatDamage& damage)
{
if (attacker->getMonster())
{
damage.primary.value *= 1.5;
damage.secondary.value *= 1.5;
}
bool Game::combatChangeHealth(Creature* attacker, Creature* target, CombatDamage& damage)
{
const Position& targetPos = target->getPosition();
if (damage.primary.value > 0) {
if (target->getHealth() <= 0) {
return false;
}
if (attacker->getMonster())
{
damage.primary.value *= 1.5;
damage.secondary.value *= 1.5;
}
function onHealthChange(player, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if not attacker then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
if attacker:isMonster() and not attacker:getMaster() then
primaryDamage = primaryDamage*3
secondaryDamage = secondaryDamage*3
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
function onManaChange(player, attacker, manaChange, origin)
if not attacker then
return manaChange
end
if attacker:isMonster() and not attacker:getMaster() then
manaChange = manaChange *3
end
return manaChange
end