public void removeMonsterToBuilding() { if (FatherBuilding != null) { switch (reraty) { case "common": { FatherBuilding.GetComponent <MonstersDen>().CurrentCommons--; break; } case "rare": { FatherBuilding.GetComponent <MonstersDen>().CurrentRares--; break; } case "elite": { FatherBuilding.GetComponent <MonstersDen>().CurrentElits--; break; } case "boss": { FatherBuilding.GetComponent <MonstersDen>().CurrentBosses--; break; } } } }
public void AddMonsterToBuilding(string Reraty) { if (FatherBuilding != null) { Gold = 0; TotalGold = 0; int GoldWorth = 0; switch (Reraty) { case "common": { GoldWorth = Lvl * (Random.Range(1, 5) * 2); FatherBuilding.GetComponent <MonstersDen>().CurrentCommons++; Gold = GoldWorth; RecieveGold(GoldWorth); break; } case "rare": { GoldWorth = Lvl * (Random.Range(3, 7) * 2); FatherBuilding.GetComponent <MonstersDen>().CurrentRares++; Gold = GoldWorth; RecieveGold(GoldWorth); break; } case "elite": { GoldWorth = Lvl * (Random.Range(4, 10) * 2); FatherBuilding.GetComponent <MonstersDen>().CurrentElits++; Gold = GoldWorth; RecieveGold(GoldWorth); break; } case "boss": { GoldWorth = Lvl * (Random.Range(10, 15) * 2); FatherBuilding.GetComponent <MonstersDen>().CurrentBosses++; Gold = GoldWorth; RecieveGold(GoldWorth); break; } } } else { Destroy(this.gameObject); } }
public override void TrueTakeDmg(float Dmg) { int num = Random.Range(0, 3); if (num >= 2 && takeingDmgSound.Length < 0) { int ran = Random.Range(0, takeingDmgSound.Length); Instantiate(takeingDmgSound[ran], this.gameObject.transform.position, transform.rotation); } float DmgDealt = Dmg; if (FloatingtextPrefab) { ShowFloatingtext(); } if (DmgDealt <= 0) { DmgDealt = 0; } CurrentHP -= DmgDealt; if ((Monster == false && isSummon == false && Guard == false && Worker == false && Merchent == false)) { if (isMyPanelOpen()) { charData.updateText(); } } LastDmgTaken = (int)DmgDealt; MyDmgDealt += (int)DmgDealt; if (isSummon == false && !Monster) { analytics.OnDataChanged(this.gameObject, "Damage Dealt");//analytics } if (IWasHitBy != null) { float MyDmgDealt = IWasHitBy.GetComponent <NPC>().MyDmgDealt + DmgDealt; } if (CurrentHP <= 0) { IsDead = true; if (Worker || Guard || Merchent) { FatherBuilding.GetComponent <TownHall>().RemoveFromWork(this.gameObject); } if (Monster == true) { StartCoroutine(Die()); } removeMonsterToBuilding(); if (dieSound != null) { Instantiate(dieSound, this.gameObject.transform.position, transform.rotation); } } else if ((CurrentHP < HP) && (IsDead == false) && (RegenOn == false)) { RegenOn = true; Regen = StartCoroutine(Regeneration()); } }
private void Start() { HP = Lvl * 20; CurrentHP = HP; Defence = 1; //if (Monster == true || isSummon == true) //{ // Defence = Lvl * 7; //} if (isSummon) { STR = 0; DEX = 0; INT = 0; } UpdateAllStats(BaseSTR, BaseDEX, BaseINT); CurrentCritMulti = BaseCritMulti; CurrentCritChance = BaseCritChance; CurrentMana = MaxMana; if ((isSummon || Monster || Worker || Guard || Merchent) && FatherBuilding == null && MyKingdom == null) { TakeDmg(CurrentHP * 100); Die(); } if (!isSummon) { UpdateEXP(); } if (Monster) { AddMonsterToBuilding(this.reraty); } if (Monster == true && FatherBuilding == null) { Destroy(this.gameObject); } if (isSummon && FatherBuilding != null) { FatherBuilding.GetComponent <SummonCount>().summonsList.Add(this.gameObject); } ; if (!isSummon && !Monster && !Worker && !Guard && !Merchent) { AmIPL = false; Guild = "Not a Guild Memeber"; CloseDisplay(); PrevLvlXP = 0; XpNeededToLvl = 10; Looted = false; if (Lvl != 1) { UpdateEXP(); } //analytics total MyDmgDealt = 0; Kills = 0; TotalGold = 0; TotalObjectives = 0; TotalHealing = 0; } if (isSummon) { FatherBuilding = SummonStats.TheCaster.gameObject; SummonStats.SkillAbility(this.gameObject); CharName = SummonType.ToString(); if (FatherBuilding.tag != this.gameObject.tag) { SummonCounReduction(); Destroy(this.gameObject); } if (FatherBuilding == null) { SummonCounReduction(); Destroy(this.gameObject); } foreach (GameObject skill in skills) { skill.GetComponent <Skills>().npc = this; } //auto skill reset incase skills saves theyre cds for (int i = 0; i < skills.Length; i++) { if (skills[i].GetComponent <Skills>().Current_CoolDown > 0) { skills[i].GetComponent <Skills>().Current_CoolDown = 0; } if (skills[i].GetComponent <Skills>().currentAmmo <= 0) { skills[i].GetComponent <Skills>().currentAmmo = skills[i].GetComponent <Skills>().ammo; } } } }