public GameObject Spawn(MonsterStatsPanelController statsPanelController) { List <Humour> humours = new List <Humour> { new Aggressive(), new Contrarian(), new Pacifist(), new Lazy(), new Rebel(), new Obedient() }; List <IMonsterType> monsterTypes = new List <IMonsterType> { new FallType(), new SpringType(), new SummerType(), new WinterType() }; List <string> names = new List <string> { "Seu Bezerro", "Milkshake", "Zé", "Fubanga", "Fuleco", "Enel" }; int health = rand.Next(5, 11); int strength = rand.Next(0, 11); int defense = rand.Next(0, 11); int speed = rand.Next(0, 5); string name = names[rand.Next(0, names.Count)]; Humour humour = humours[rand.Next(0, humours.Count)]; IMonsterType type = monsterTypes[rand.Next(0, monsterTypes.Count)]; Monster monster = new Monster { Strength = strength, Defense = defense, MaxHealth = health, Health = health, Speed = speed, Type = type, Humour = humour, Name = name, HasFled = false }; var prefabInstance = Instantiate(_monsterPrefab); prefabInstance.GetComponent <Image>().sprite = MonsterSprites[rand.Next(0, MonsterSprites.Count)]; prefabInstance.GetComponent <MonsterController>().Init(monster, statsPanelController); return(prefabInstance); }
private static double GetBasicMultiplier(IMonsterType element, IList <IMonsterType> defenderTypes) { double retVal = 0.0d; foreach (var defenderType in defenderTypes) { retVal += element.GetMultiplierAgainstType(defenderType.GetType()); } return(retVal / defenderTypes.Count()); }
/// <summary> /// Initializes a new instance of the <see cref="Monster"/> class. /// </summary> /// <param name="monsterType">The type of this monster.</param> /// <param name="itemFactory">A reference to the item factory in use.</param> public Monster(IMonsterType monsterType, IItemFactory itemFactory) : base(monsterType.Name, monsterType.Article, monsterType.MaxHitPoints, monsterType.MaxManaPoints, monsterType.Corpse) { this.Type = monsterType; this.Experience = monsterType.Experience; this.Speed += monsterType.Speed; this.Outfit = monsterType.Outfit; this.Inventory = new MonsterInventory(itemFactory, this, monsterType.InventoryComposition); //foreach (var kvp in this.Type.Skills.ToList()) //{ // this.Type.Skills[kvp.Key] = kvp.Value; //} }
public float GetDamageModifier(IMonsterType attacker) => this.Type.AddVulnerability(attacker.GetMonsterType());