/// <summary> /// Get the skills list to add on for a specific stat class /// </summary> /// <param name="stClass">The stat class to get</param> /// <param name="reference">The skill set to get, -1 for random, 0 when default is player, 1 when default is monster</param> /// <returns></returns> public static List<AttackID> GetSkillsFor(StatClass stClass, int reference) { if (_classSkills.ContainsKey(stClass)) { if (reference != -1) { if (_classSkills[stClass].ContainsKey(reference)) { return _classSkills[stClass][reference]; } } else { if (_classSkills[stClass].Count > 0) { return _classSkills[stClass][rndm.Next(_classSkills[stClass].Count)]; } } } if (stClass == StatClass.Default) return _classSkills[stClass][reference % 2]; //0 or 1 return new List<AttackID>(); }
public EntityStatsContainer() { //Randomize DNA values //DNA values range from -50 to +30 to make them range from 50 at level 100 to 130 at level 100 _dna = new int[ST_Count]; for (int i = 0; i < ST_Count; i++) { _dna[i] = rnd.Next(81) - 50; } this.stClass = StatClass.Default; updateAttributes(); }
public EntityStatsContainer(StatClass stClass) { this.stClass = stClass; var dnaSeeds = StatsFactory.GetMixMax(stClass); _dna = new int[ST_Count]; _dna[ST_VIT] = dnaSeeds[0, 0] + rnd.Next(dnaSeeds[0, 1] - dnaSeeds[0, 1]); _dna[ST_INT] = dnaSeeds[1, 0] + rnd.Next(dnaSeeds[1, 1] - dnaSeeds[1, 1]); _dna[ST_DEX] = dnaSeeds[2, 0] + rnd.Next(dnaSeeds[2, 1] - dnaSeeds[2, 1]); _dna[ST_STR] = dnaSeeds[3, 0] + rnd.Next(dnaSeeds[3, 1] - dnaSeeds[3, 1]); _dna[ST_VIT] = dnaSeeds[4, 0] + rnd.Next(dnaSeeds[4, 1] - dnaSeeds[4, 1]); updateAttributes(); }
public Player() { stClass = StatsFactory.GetRandom(); Name = "Plyr " + stClass.ToString(); Image = "41x24"; Stats = new EntityStatsContainer(stClass); Stats.Level = 4; Stats.updateAttributes(); Stats.FullHeal(); Stats.SkillsList.AddRange(SkillSetFactory.GetSkillsFor(StatClass.Default, 0)); Stats.SkillsList.AddRange(SkillSetFactory.GetSkillsFor(stClass, -1)); Stats.SkillsList = Stats.SkillsList.Intersect(Stats.SkillsList).ToList(); MyParty = new Party(); MyParty.Front = this; //Player starts in front of party }
//Use Potion on Hero public void UsePotion(StatClass Hero, StatClass Potion) { if (Potion.STATUS == "POTION") { Hero.HP += Potion.HP; if (Hero.HP > Hero.MaxHP) { Hero.HP = Hero.MaxHP; } Destroy(_instance); haspotion = false; } else if (Potion.STATUS == "PSN") { Hero.STATUS = "NA"; Hero.HP += Potion.HP; Hero.PWR += Potion.PWR; if (Hero.HP > Hero.MaxHP) { Hero.HP = Hero.MaxHP; } Destroy(_instance); haspotion = false; } /*else if(Potion.STATUS == "PSNRES") * { * Hero.STATUS = "PSNRES"; * //resistance only lasts 1 turn * } */ else if (Potion.STATUS == "ATK") { Hero.PWR += Potion.PWR; Destroy(_instance); haspotion = false; Hero.BNSPWR = Potion.PWR; //need variable to reset PWR to normal after next attack } /*else if(Potion.STATUS == "NA") * { * Destroy (_instance); * Debug.Log("Nothing happened"); * }*/ }
//Crafting Function public void giveHero() { string buttonname = EventSystem.current.currentSelectedGameObject.name; StatClass Hero = new StatClass(); for (int x = 0; x < 3; x++) { if (Heroes[x].stats.NAME == buttonname) { Hero = Heroes[x].stats; break; } } if (haspotion == true) { UsePotion(Hero, PlayerPTN); } }
public EnemyPrefab(int level) { stClass = StatsFactory.GetRandom(); Name = "Mns " + stClass.ToString(); //TODO: monster naming Image = "15x5"; //TODO: monster sprites Stats = new EntityStatsContainer(stClass); Stats.Level = 3; Stats.updateAttributes(); Stats.FullHeal(); OverworldAI = new DefaultOverworldAI(); CombatAI = new DefaultCombatAI(); MyParty = new Party(); MyParty.Front = this; Stats.SkillsList.AddRange(SkillSetFactory.GetSkillsFor(StatClass.Default, 1)); Stats.SkillsList.AddRange(SkillSetFactory.GetSkillsFor(stClass, -1)); Stats.SkillsList = Stats.SkillsList.Intersect(Stats.SkillsList).ToList(); canLink = true; }
// Use this for initialization void Start() { //setting players Level CharacterLevel = Inspector_Character_Level; //Setting up stat Classes for the Player HP = new StatClass("HP", "This is the total amount of health points that the user has and damage taken will reduce the amount of HP, " + "but can be restored through potions. When the health points hit 0, the user will faint and it will be Game Over.", Convert.ToInt32(((CharacterLevel * 60) / 1.7))); Attack = new StatClass("Attack", "This is the attack power that the user has, this affect amount of damage the user can inflict on the enemy. The higher the stat, the more damage can be inflicted on the enemy.", Convert.ToInt32(((CharacterLevel * 60) / 5.7))); Defence = new StatClass("Defence", "This is the amount of Defensive power the user has, this will reduce the amount of damage inflicted on the user when attacked. A higher Defence means more damage reduction.", Convert.ToInt32(((CharacterLevel * 60) / 6.5))); Agility = new StatClass("Agility", "This is how quick the user is, it affects skill cooldown time as well as frequency of the users attacks. The higher the stat, the more attacks the user can do and a further reduction in cooldown time", Convert.ToInt32(((CharacterLevel * 60) / 4.8))); //Setting Players Base Exp Requirement Level_Experience_Required = Inspector_Required_Experience_Points; //setting the players current HP to Max currentHP = HP.getModifiedStatValue(); //updating UI HP Gauge updateUIHPGauge(); }
//int bonusPWR = 2; << BONUSPOWER public void Setup(StatClass stats) { this.stats = stats; stats.TIMER = stats.SPD; }
public static int[,] GetMixMax(StatClass stClass) { if (statData.ContainsKey(stClass)) { return statData[stClass]; } return statData[StatClass.Default]; }
//add items from drop //shelf stuff public void itemSelect() { string name = EventSystem.current.currentSelectedGameObject.name; Image[] images = EventSystem.current.currentSelectedGameObject.GetComponentsInChildren <Image>(true); Image theimage = images[1]; StatClass itemselect = getitembyID(name); if (itemselect.STATUS == "BASE") { if (Item[0] != null && Item[0] != itemselect.NAME) { GameObject unselect = GameObject.Find(Item[0]); Image[] oldimages = unselect.gameObject.GetComponentsInChildren <Image>(); Image oldimage = oldimages[1]; oldimage.gameObject.SetActive(false); theimage.gameObject.SetActive(true); Debug.Log(itemselect.NAME + " is seleceted"); Item[0] = itemselect.NAME; Box[0].gameObject.SetActive(true); Box[0].GetComponent <Image>().sprite = EventSystem.current.currentSelectedGameObject.GetComponent <Image>().sprite; } else if (Item[0] == itemselect.NAME) { theimage.gameObject.SetActive(false); Item[0] = null; Box[0].gameObject.SetActive(false); Box[0].GetComponent <Image>().sprite = EventSystem.current.currentSelectedGameObject.GetComponent <Image>().sprite; } else { theimage.gameObject.SetActive(true); Item[0] = itemselect.NAME; Box[0].gameObject.SetActive(true); Box[0].GetComponent <Image>().sprite = EventSystem.current.currentSelectedGameObject.GetComponent <Image>().sprite; } } else if (itemselect.STATUS == "FIRST") { if (Item[1] != null && Item[1] != itemselect.NAME) { GameObject unselect = GameObject.Find(Item[1]); Image[] oldimages = unselect.gameObject.GetComponentsInChildren <Image>(); Image oldimage = oldimages[1]; oldimage.gameObject.SetActive(false); theimage.gameObject.SetActive(true); theimage.gameObject.SetActive(true); Debug.Log(itemselect.NAME + " is seleceted"); Item[1] = itemselect.NAME; Box[1].gameObject.SetActive(true); Box[1].GetComponent <Image>().sprite = EventSystem.current.currentSelectedGameObject.GetComponent <Image>().sprite; } else if (Item[1] == itemselect.NAME) { theimage.gameObject.SetActive(false); Item[1] = null; Box[1].gameObject.SetActive(false); Box[1].GetComponent <Image>().sprite = EventSystem.current.currentSelectedGameObject.GetComponent <Image>().sprite; } else { theimage.gameObject.SetActive(true); Item[1] = itemselect.NAME; Box[1].gameObject.SetActive(true); Box[1].GetComponent <Image>().sprite = EventSystem.current.currentSelectedGameObject.GetComponent <Image>().sprite; } } else if (itemselect.STATUS == "SECOND") { if (Item[2] != null && Item[2] != itemselect.NAME) { GameObject unselect = GameObject.Find(Item[2]); Image[] oldimages = unselect.gameObject.GetComponentsInChildren <Image>(); Image oldimage = oldimages[1]; oldimage.gameObject.SetActive(false); theimage.gameObject.SetActive(true); theimage.gameObject.SetActive(true); Debug.Log(itemselect.NAME + " is seleceted"); Item[2] = itemselect.NAME; Box[2].gameObject.SetActive(true); Box[2].GetComponent <Image>().sprite = EventSystem.current.currentSelectedGameObject.GetComponent <Image>().sprite; } else if (Item[2] == itemselect.NAME) { theimage.gameObject.SetActive(false); Item[2] = null; Box[2].gameObject.SetActive(false); Box[2].GetComponent <Image>().sprite = EventSystem.current.currentSelectedGameObject.GetComponent <Image>().sprite; } else { theimage.gameObject.SetActive(true); Item[2] = itemselect.NAME; Box[2].gameObject.SetActive(true); Box[2].GetComponent <Image>().sprite = EventSystem.current.currentSelectedGameObject.GetComponent <Image>().sprite; } } }
//Crafting Function public void Craft(string BASE, string frsting, string scnding) { StatClass potion = null; if (BASE == "Water") { if (scnding == "Venom" && frsting != null) { potion = getitembyID("WTRVen"); POTIONprefab.GetComponent <Image>().sprite = CURE; invcount[5] -= 1; for (int x = 0; x < 6; x++) { if (frsting == PlayerInv[x]) { invcount[x] -= 1; } } } else if (frsting == "Herb") { potion = getitembyID("WTRhrb"); POTIONprefab.GetComponent <Image>().sprite = HP; invcount[3] -= 1; } else if (frsting == "Mushroom") { potion = getitembyID("WTRpow"); POTIONprefab.GetComponent <Image>().sprite = ATK; invcount[4] -= 1; } invcount[0] -= 1; } else if (BASE == "Wine") { if (scnding == "Venom" && frsting == "Herb") { potion = getitembyID("WINVen"); potion.HP = 1; POTIONprefab.GetComponent <Image>().sprite = CURE; invcount[5] -= 1; invcount[3] -= 1; } else if (scnding == "Venom" && frsting == "Mushroom") { potion = getitembyID("WINVen"); potion.PWR = 1; POTIONprefab.GetComponent <Image>().sprite = CURE; invcount[5] -= 1; invcount[4] -= 1; } else if (frsting == "Herb") { potion = getitembyID("WINhrb"); POTIONprefab.GetComponent <Image>().sprite = HP; invcount[3] -= 1; } else if (frsting == "Mushroom") { potion = getitembyID("WINpow"); POTIONprefab.GetComponent <Image>().sprite = ATK; invcount[4] -= 1; } invcount[2] -= 1; } else if (BASE == "Oil") { //oil need visual indicator to inform player if he got a bad or good result int oilRDM; oilRDM = Random.Range(0, 2); if (scnding == "Venom" && frsting != null) { potion = getitembyID("OILVen"); if (oilRDM == 0) { potion.STATUS = "PSN"; if (frsting == "Herb") { potion.HP = -1; invcount[3] -= 1; } else if (frsting == "Mushroom") { potion.PWR = -1; invcount[4] -= 1; } } else if (oilRDM == 1) { potion.STATUS = "PSN"; if (frsting == "Herb") { potion.HP = 0; invcount[3] -= 1; } else if (frsting == "Mushroom") { potion.PWR = 0; invcount[4] -= 1; } } else if (oilRDM == 2) { potion.STATUS = "PSN"; if (frsting == "Herb") { potion.HP = 1; invcount[3] -= 1; } else if (frsting == "Mushroom") { potion.PWR = 1; invcount[4] -= 1; } } POTIONprefab.GetComponent <Image>().sprite = CURE; invcount[5] -= 1; } else if (frsting == "Herb") { potion = getitembyID("OILhrb"); if (oilRDM == 0) { potion.HP = 0; } else if (oilRDM == 1) { potion.HP = 2; } else if (oilRDM == 2) { potion.HP = 3; } POTIONprefab.GetComponent <Image>().sprite = HP; invcount[3] -= 1; } else if (frsting == "Mushroom") { potion = getitembyID("OILpow"); if (oilRDM == 0) { potion.PWR = 1; } else if (oilRDM == 1) { potion.PWR = 2; } else if (oilRDM == 2) { potion.PWR = 3; } POTIONprefab.GetComponent <Image>().sprite = ATK; invcount[4] -= 1; } invcount[1] -= 1; } PlayerPTN = potion; //cauldron cooldown cauldronCD = potion.SPD; //Debug.Log("Success " + BASE + frsting + scnding + PlayerPTN.NAME); }