void Awake() { if (_instance == null) { _instance = this; } }
public static int Worth(Agent agent, bool includeWeapon) { int worth = 0; var stats = agent.stats; worth += instance.Health.Cost(stats.maxHealth); worth += instance.ActionPoints.Cost(stats.actionPointsPerTurn); worth += instance.Defence.Cost(stats.defence); Debug.Log(string.Format("{0} has worth {1} (weapon not included)", agent.name, worth)); if (includeWeapon) { worth += WeaponSmith.Worth(agent.Weapon); } return(worth); }
public static Monster Smith(int points) { var monster = instance.GetFreeMonster(); var abilityState = instance.blankState; Ability fancy = new List <Ability>(abilityState.Keys)[Random.Range(0, abilityState.Count)]; if (Random.value > instance.likelihoodToBias) { fancy = null; } int weaponPoints = instance.GetWeaponPoints(ref points); Debug.Log(string.Format("Smitting monster worth maximum {0} plus minimum {1} weapon points.", points, weaponPoints)); while (Upgrade(ref abilityState, ref points, fancy)) { ; } monster.SetStats(instance.createMonster(abilityState)); monster.Weapon.SetStats(WeaponSmith.Smith(weaponPoints + points, true)); return(monster); }