public void revalidateButtons(Champion a_champion) { switch (m_buttonListType) { case ButtonListType.ChmpnMain: findButton("Move").p_state = a_champion.p_hasMoved ? Button.State.Disabled : Button.State.Normal; findButton("Action").p_state = a_champion.p_actionTaken ? Button.State.Disabled : Button.State.Normal; break; case ButtonListType.ChmpnAction: //TODO Kolla typ om en champion har silence eller något som gör så att de inte kan röra sig eller attackera break; case ButtonListType.ChmpnAbility: int l_currentMana = a_champion.getStat("CurrentMana"); foreach (Ability l_ability in a_champion.getAbilities()) { #if DEBUG findButton(l_ability.getName()).p_state = l_currentMana <= l_ability.getCost() ? Button.State.Disabled : Button.State.Normal; #else try { findButton(l_ability.getName()).p_state = l_currentMana <= l_ability.getCost() ? Button.State.Disabled : Button.State.Normal; } catch (NullReferenceException) { System.Console.WriteLine("Ability was found in champion ability list but not in menu when trying to revalidate buttons"); } #endif } break; } }
public static int attack(Champion a_attacker, Champion a_defender) { return(Math.Max((a_attacker.getStat("attack") - a_defender.getStat("defense")), 0)); }