public override uint UsageProbability(BattleField bf){ //TODO: I NEED TO CHANGE THIS foreach(ActiveCharacter c in bf.Allies){ if (c.CurrentHP < (((double)c.Stats.HP) / 2)) return 20; } return 0; }
public static void Main (string[] args) { uint SIMULATIONS = 10000, wins = 0; for (int i = 0; i < SIMULATIONS; i++) { List<ActiveUnit> allies = new List<ActiveUnit> (); allies.Add (new Character ("Nic", "", 4, 1, new uint[]{ 0, 1, 2 }, null, typeof(Drifter), new EquipmentSet(new IronHelm(), null, null, null, null, new WoodShield(), null, null )).CreateActiveCharacter ()); List<ActiveUnit> enemies = new List<ActiveUnit> (); Enemy e = new Enemy ("Slime", typeof(Slime), 4); enemies.Add (e.CreateActiveEnemy ()); enemies.Add (e.CreateActiveEnemy ()); enemies.Add (e.CreateActiveEnemy ()); enemies.Add (e.CreateActiveEnemy ()); enemies.Add (e.CreateActiveEnemy ()); BattleField bf = new BattleField (allies, enemies); bool win = bf.Simulate (); if (win) { wins++; } } double chance = (((double)wins) / ((double)SIMULATIONS)) * 100; Console.WriteLine ("\n\nWIN CHANCE: " + chance); }
public Ability SelectAbility(BattleField bf){ uint index = 0, i = 0; uint maxweight = 0; foreach (Ability s in skills) { uint up = s.UsageProbability (bf); if (up > maxweight && s.CurrentCooldown == 0) { maxweight = up; index = i; } i++; } return skills [(int)index]; }
public abstract uint UsageProbability(BattleField bf);
public override uint UsageProbability(BattleField bf){ return 1; }