// this factory produces skills from BasicSpells directory public Skill CreateSkill(Player player) { List <Skill> playerSkills = player.ListOfSkills; Skill known = CheckContent(playerSkills); // check what spells from the BasicSpells category are known by the player already if (known == null) // no BasicSpells known - we will return one of them { FireArrow s1 = new FireArrow(); LightFlash s2 = new LightFlash(); WindGust s3 = new WindGust(); // only include elligible spells List <Skill> tmp = new List <Skill>(); if (s1.MinimumLevel <= player.Level) { tmp.Add(s1); // check level requirements } if (s2.MinimumLevel <= player.Level) { tmp.Add(s2); } if (s3.MinimumLevel <= player.Level) { tmp.Add(s3); } if (tmp.Count == 0) { return(null); } Console.WriteLine(tmp.Count); return(tmp[Index.RNG(0, tmp.Count)]); // use Index.RNG for safe random numbers } else if (known.decoratedSkill == null) // a BasicSpell has been already learned, use decorator to create a combo { FireArrowDecorator s1 = new FireArrowDecorator(known); LightFlashDecorator s2 = new LightFlashDecorator(known); WindGustDecorator s3 = new WindGustDecorator(known); List <Skill> tmp = new List <Skill>(); if (s1.MinimumLevel <= player.Level) { tmp.Add(s1); // check level requirements } if (s2.MinimumLevel <= player.Level) { tmp.Add(s2); } if (s3.MinimumLevel <= player.Level) { tmp.Add(s3); } if (tmp.Count == 0) { return(null); } return(tmp[Index.RNG(0, tmp.Count)]); } else { return(null); // a combo of BasicSpells has been already learned - this factory doesn't offer double combos so we stop here } }
// this factory produces skills from BasicSpells directory public Skill CreateSkill(Player player) { List <Skill> playerSkills = player.ListOfSkills; List <Skill> tmp = new List <Skill>(); FireArrow s1 = new FireArrow(); WindGust s2 = new WindGust(); DeepBreath s3 = new DeepBreath(); ChargeGSArmor s4 = new ChargeGSArmor(); if (s1.MinimumLevel <= player.Level) { tmp.Add(s1); // check level requirements } if (s2.MinimumLevel <= player.Level) { tmp.Add(s2); } if (s3.MinimumLevel <= player.Level) { tmp.Add(s3); } if (s4.MinimumLevel <= player.Level) { tmp.Add(s4); } foreach (Skill skill in playerSkills) // don't offer skills which the player knows already { if (skill is FireArrow) { tmp.Remove(s1); } if (skill is WindGust) { tmp.Remove(s2); } if (skill is DeepBreath) { tmp.Remove(s3); } if (skill is ChargeGSArmor) { tmp.Remove(s4); } } if (tmp.Count == 0) { return(null); } return(tmp[Index.RNG(0, tmp.Count)]); }
/// <summary> /// Instantiate arrrow in game. /// </summary> private void InstantiateArrow() { // if player has enough stamina, shoot arrow. if (staminaManager.currentStamina > 5 && arrrowItem.NumberHold > 0) { var amountOfStamina = 30; staminaManager.DecreaseStamina(amountOfStamina); arrrowItem.NumberHold -= 1; UpdateArrowUI.Raise(); Vector2 tempPos = new Vector2(animator.GetFloat("OldHorizontalValue"), animator.GetFloat("OldVerticalValue")); FireArrow projectile = Instantiate(arrowPrefab, transform.position, Quaternion.identity).GetComponent <FireArrow>(); projectile.Setup(tempPos, ArrowFacingDirection()); } }
private void AmazonSkill_VisibleChanged(object sender, EventArgs e) { MagicArrow.SetSkillPoints = "0"; FireArrow.SetSkillPoints = "0"; ColdArrow.SetSkillPoints = "0"; MultyArrow.SetSkillPoints = "0"; ExplodingArrow.SetSkillPoints = "0"; IceArrow.SetSkillPoints = "0"; GuideArrow.SetSkillPoints = "0"; FireWallArrow.SetSkillPoints = "0"; SplitArrow.SetSkillPoints = "0"; FrozenArrow.SetSkillPoints = "0"; MagicArrow.setTextBoxColor(); FireArrow.setTextBoxColor(); ColdArrow.setTextBoxColor(); MultyArrow.setTextBoxColor(); ExplodingArrow.setTextBoxColor(); IceArrow.setTextBoxColor(); GuideArrow.setTextBoxColor(); FireWallArrow.setTextBoxColor(); SplitArrow.setTextBoxColor(); FrozenArrow.setTextBoxColor(); }
public string String() { // ID[covered-in-data] ..... return(active.ToString() + " " + Name + " " + Pos.X.ToString() + " " + Pos.Y.ToString() + " " + planet.ToString() + " " + bearing.ToString() + " " + FireArrow.ToString()); }