//fight functions public WarriorState TakeDamage(Warrior attacker, DamageMethod method, int value) { var beginValue = value; WarriorState warriorState = WarriorState.ALIVE; if (Armour > 0) { var armourRemaining = Armour; Armour -= value; if (Armour <= 0) { value -= armourRemaining;//deal damage to armour, take all armour and next deal damage to hitpoints warriorState = WarriorState.NO_ARMOUR; } else { value = 0; } } if (value > 0) { Hitpoints -= value; if (Hitpoints <= 0) { warriorState = WarriorState.DEAD; } } Console.WriteLine($"{attacker.Name} deals {beginValue} damage to {Name} leaving {Armour} armour,{Hitpoints} hitpoints left"); State = warriorState; return(warriorState); }
public void Setup(DamageMethod method, DamageSourceTag source, int hits, float proximityInterval, int pointvalue, GameObject partsObject) { damageMethod = method; damageSource = source; hitPoints = hits; proximityDamageInterval = proximityInterval; victoryPointValueWhenKilled = pointvalue; particlesObject = partsObject; }
public void BlockDamage(DamageMethod method) { Console.WriteLine($"{Name} Blocked attack!"); }