public void AddSkill(Skill skill, int level) { if (skill == null || !skill.CharacterHasRequirements(this)) { return; } Spell spell = skill as Spell; if (spell == null) { Skills.Add(new SkillInstance(skill, level)); } else { Spells.Add(new SpellInstance(spell, level)); } foreach (string subskill in skill.AdditionalSkillsGranted) { if (subskill != skill.Name) { Skill newSkill = SkillFactory.FindSkillByName(subskill); if (newSkill != null) { AddSkill(newSkill, 1); } else { AddSkill(SpellFeactory.FindSpellByName(subskill), 1); } } } }
public static Character NewBandit(Vector3 location) { Monster mon = new Monster(); mon.Name = "Bandit"; if (UnityEngine.Random.value > 0.125) { mon.MaleLayers.Add("TempSprites/Materials/bandit"); } else { mon.MaleLayers.Add("TempSprites/Materials/bandit_cheif"); mon.Name = "Fancy Bandit"; } mon.FemaleLayers = mon.MaleLayers; SetStats(mon, 2, 2, 2, 25); mon.AddSkill(SkillFactory.FindSkillByName("Swords"), 3); mon.InventoryItems.GoldCoins = (int)UnityEngine.Random.Range(20, 120); mon.EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon); mon.EquipItem(ItemFactory.FindItemByName("Leather Armor") as Equipment, Equipment.EquipmentLocation.Torso); mon.BackpackItem(ItemFactory.FindItemByName("Watermelon")); mon.Smarts = new FightOrFlight(0.3f, 0.5f); return(AttachToGame(mon, location, 1.25f)); }
public static Character NewOrc(Vector3 location) { Monster orc = new Monster(); orc.Name = "Orc"; if (UnityEngine.Random.value > 0.5) { orc.MaleLayers.Add("TempSprites/Materials/ork"); } else { orc.MaleLayers.Add("TempSprites/Materials/orc2"); } orc.FemaleLayers = orc.MaleLayers; SetStats(orc, 3, 1, 2, 25); orc.AddSkill(SkillFactory.FindSkillByName("Swords"), 1); orc.AddSkill(SkillFactory.FindSkillByName("Tough"), 2); orc.AddSkill(SkillFactory.FindSkillByName("Cleave"), 2); orc.InventoryItems.GoldCoins = (int)UnityEngine.Random.Range(10, 20); orc.EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon); orc.EquipItem(ItemFactory.FindItemByName("Leather Armor") as Equipment, Equipment.EquipmentLocation.Torso); orc.BackpackItem(ItemFactory.FindItemByName("Watermelon")); orc.Smarts = new FightOrFlight(); return(AttachToGame(orc, location, 1.45f)); }
public static Character NewSkellymans(Vector3 location) { Monster mon = new Monster(); mon.Name = "Skellyman"; bool isFancy = UnityEngine.Random.value < 0.25; if (!isFancy) { mon.MaleLayers.Add("TempSprites/Materials/skeleton"); } else { mon.MaleLayers.Add("TempSprites/Materials/skeleton_chain"); mon.Name = "Dire " + mon.Name; } mon.FemaleLayers = mon.MaleLayers; if (isFancy) { SetStats(mon, 2, 1, 1, 25); } else { SetStats(mon, 3, 0, 2, 50); } mon.AddSkill(SkillFactory.FindSkillByName("Swords"), isFancy ? 4 : 2); mon.InventoryItems.GoldCoins = 0; mon.EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon); mon.EquipItem(ItemFactory.FindItemByName(isFancy ? " Mail Armor" : "Leather Armor") as Equipment, Equipment.EquipmentLocation.Torso); // mon.BackpackItem(ItemFactory.FindItemByName("Watermelon")); mon.Smarts = new FightToDeath(0.75f); return(AttachToGame(mon, location, 1.25f)); }
public override void Init() { HitSound = Resources.Load("Sounds/Monsters/squirrel/squirrel-hurt1") as AudioClip; DieSound = Resources.Load("Sounds/Monsters/squirrel/squirrel-die2") as AudioClip; // TODO, when unity material bug is fixed, remove these lines FemaleLayers.Add("TempSprites/Materials/body_f_base"); FemaleLayers.Add("TempSprites/Materials/body_f_base_hat"); FemaleLayers.Add("TempSprites/Materials/body_f_leather"); FemaleLayers.Add("TempSprites/Materials/body_f_leather_hat"); FemaleLayers.Add("TempSprites/Materials/body_f_plate"); FemaleLayers.Add("TempSprites/Materials/body_f_plate_helm"); MaleLayers.Add("TempSprites/Materials/body_m_base"); MaleLayers.Add("TempSprites/Materials/body_m_base_hat"); MaleLayers.Add("TempSprites/Materials/body_m_leather"); MaleLayers.Add("TempSprites/Materials/body_m_leather_hat"); MaleLayers.Add("TempSprites/Materials/body_m_chain"); MaleLayers.Add("TempSprites/Materials/body_m_chain_hat"); BaseLayer = this.Gender == Character.Genders.Female ? "Races/Materials/body_f" : "Races/Materials/body_m"; HairLayer = this.Gender == Character.Genders.Female ? "Races/Hair/Materials/hair0_f" : "Races/Hair/Materials/hair0_m"; EyeLayer = this.Gender == Character.Genders.Female ? "Races/Materials/eyes_f" : "Races/Materials/eyes_m"; if (PlayerPrefs.GetInt("PlayType") == 2) { Name = "Joan"; XP = 5000; Attributes.Add(Attribute.AttributeTypes.Might, new AttributeInstance(SkillFactory.Might, 20)); Attributes.Add(Attribute.AttributeTypes.Smarts, new AttributeInstance(SkillFactory.Smarts, 20)); Attributes.Add(Attribute.AttributeTypes.Agility, new AttributeInstance(SkillFactory.Agility, 10)); AddSkill(SkillFactory.FindSkillByName("Swords"), 10); AddSkill(SkillFactory.FindSkillByName("Tough"), 15); AddSkill(SkillFactory.FindSkillByName("Cleave"), 5); AddSkill(SkillFactory.FindSkillByName("Dodge"), 10); AddSkill(SkillFactory.FindSkillByName("Arcane"), 10); EquipItem(ItemFactory.FindItemByName("Plate Armor") as Equipment, Equipment.EquipmentLocation.Torso); EquipItem(ItemFactory.FindItemByName("Flaming Sword of Fire") as Equipment, Equipment.EquipmentLocation.Weapon); BackpackItem(ItemFactory.FindItemByName("Leather Hat")); BackpackItem(ItemFactory.FindItemByName("Small Health Potion")); BackpackItem(ItemFactory.FindItemByName("Watermelon")); BackpackItem(ItemFactory.FindItemByName("Large XP Potion")); } else { Name = "Tina"; Attributes.Add(Attribute.AttributeTypes.Might, new AttributeInstance(SkillFactory.Might, 2)); Attributes.Add(Attribute.AttributeTypes.Smarts, new AttributeInstance(SkillFactory.Smarts, 1)); Attributes.Add(Attribute.AttributeTypes.Agility, new AttributeInstance(SkillFactory.Agility, 2)); AddSkill(SkillFactory.FindSkillByName("Swords"), 1); AddSkill(SkillFactory.FindSkillByName("Tough"), 1); AddSkill(SkillFactory.FindSkillByName("Cleave"), 1); EquipItem(ItemFactory.FindItemByName("Cloth Shirt") as Equipment, Equipment.EquipmentLocation.Torso); EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon); BackpackItem(ItemFactory.FindItemByName("Leather Hat")); BackpackItem(ItemFactory.FindItemByName("Small Health Potion")); BackpackItem(ItemFactory.FindItemByName("Watermelon")); } base.Init(); Anims.SetSequence("Walk"); }