package Bonus import UnitClass import HeroClass import Setup public abstract class Bonus abstract function remove() ondestroy remove() public abstract class BonusType real amount boolean per construct(real amount, boolean per) this.amount = amount this.per = per abstract function getBonusTypName() returns string function getBonusAsString() returns string string s = " " if per s = "% " if amount > 0 return "+" + amount.toInt().toString() + s + getBonusTypName() else return "-" + amount.toInt().toString() + s + getBonusTypName() abstract function applyToUnit(Unit u) returns Bonus public class AttackBonus extends BonusType construct(real amount, boolean per) super(amount, per) override function applyToUnit(Unit u) returns Bonus if per return u.bonusAttackPer(amount) else return u.bonusAttack(amount) override function getBonusTypName() returns string return "Attack" public class SpellpowerBonus extends BonusType construct(real amount, boolean per) super(amount, per) override function applyToUnit(Unit u) returns Bonus if per return u.bonusSpellpowerPer(amount) else return u.bonusSpellpower(amount) override function getBonusTypName() returns string return "Spellpower" public class ArmorBonus extends BonusType construct(real amount, boolean per) super(amount, per) override function applyToUnit(Unit u) returns Bonus if per return u.bonusArmorPer(amount) else return u.bonusArmor(amount) override function getBonusTypName() returns string return "Armor" public class ResistanceBonus extends BonusType construct(real amount, boolean per) super(amount, per) override function applyToUnit(Unit u) returns Bonus if per return u.bonusResistancePer(amount) else return u.bonusResistance(amount) override function getBonusTypName() returns string return "Resistance" public class AttackspeedBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus return u.bonusAttackspeed(amount) override function getBonusTypName() returns string return "Attackspeed" public class MovespeedBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus if per return u.bonusMovespeedPer(amount) else return u.bonusMovespeed(amount) override function getBonusTypName() returns string return "Movespeed" public class LifeBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus if per return u.bonusLifePer(amount) else return u.bonusLife(amount) override function getBonusTypName() returns string return "HP" public class ManaBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus if per return u.bonusManaPer(amount) else return u.bonusMana(amount) override function getBonusTypName() returns string return "Mana" public class LifeRegBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus if per return u.bonusLifeRegPer(amount) else return u.bonusLifeReg(amount) override function getBonusTypName() returns string return "HP regeneration" public class ManaRegBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus if per return u.bonusManaRegPer(amount) else return u.bonusManaReg(amount) override function getBonusTypName() returns string return "Mana regeneration" public class LifestealBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus return u.bonusLifesteal(amount) override function getBonusTypName() returns string return "Lifesteal" public class SpellvampBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus return u.bonusSpellvamp(amount) override function getBonusTypName() returns string return "Spellvamp" public class MagicReductionBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus return u.bonusMagicReduction(amount) override function getBonusTypName() returns string return "Magic Reduction" public class NormalReductionBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus return u.bonusNormalReduction(amount) override function getBonusTypName() returns string return "Normal Reduction" public class CritchanceBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus return u.bonusCritchance(amount) override function getBonusTypName() returns string return "Critchance" public class CritdamageBonus extends BonusType construct(real amount) super(amount, true) override function applyToUnit(Unit u) returns Bonus return u.bonusCritdamage(amount) override function getBonusTypName() returns string return "Critdamage" endpackage