private void ApplyLeaderAbilityBonus(Hero hero, ref HeroBaseStats deckHeroBaseStats) { if (!hero.CanApplyLeaderStats(liderTargets)) { return; } if (leaderModifiers.Attack != null) { deckHeroBaseStats.Attack = (long)Math.Round(deckHeroBaseStats.Attack * (double)leaderModifiers.Attack); } if (leaderModifiers.Recovery != null) { deckHeroBaseStats.Recovery = (long)Math.Round(deckHeroBaseStats.Recovery * (double)leaderModifiers.Recovery); } if (leaderModifiers.Health != null) { deckHeroBaseStats.Health = (long)Math.Round(deckHeroBaseStats.Health * (double)leaderModifiers.Health); } }
private static void ApplyAffinityBonus(ref HeroBaseStats heroBaseStats, HeroStat.Affinity.Type opponentAffinity) { if (HeroStat.Affinity.Counters(heroBaseStats.AffinityType, opponentAffinity)) { heroBaseStats.Attack <<= 1; } else if (HeroStat.Affinity.Counters(opponentAffinity, heroBaseStats.AffinityType)) { heroBaseStats.Attack >>= 1; } }
public DeckStats Calculate(HeroStat.Affinity.Type opponentAffinity) { DeckStats deckStats = new DeckStats(); foreach (Hero hero in heroes) { HeroBaseStats deckHeroBaseStats = new HeroBaseStats(hero); ApplyAffinityBonus(ref deckHeroBaseStats, opponentAffinity); ApplyLeaderAbilityBonus(hero, ref deckHeroBaseStats); // ApplyEventBonus(ref deckHero); deckStats.Attack += deckHeroBaseStats.Attack; deckStats.Power += HeroStat.Power.Calculate( deckHeroBaseStats.Attack, deckHeroBaseStats.Recovery, deckHeroBaseStats.Health, deckHeroBaseStats.IsWarden ); } return(deckStats); }