public void Process_SrcUnit() { damage = Random.Range(srcUnit.GetDamageMin(), srcUnit.GetDamageMax()); float critChance = srcUnit.GetCritChance(); if (Random.Range(0f, 1f) < critChance) { critical = true; damage *= srcUnit.GetCritMultiplier(); } float dmgModifier = DamageTable.GetModifier(tgtUnit.armorType, srcUnit.damageType); damage *= dmgModifier; stunned = srcUnit.GetStun().IsApplicable(); slowed = srcUnit.GetSlow().IsValid(); dotted = srcUnit.GetDot().GetTotalDamage() > 0; if (stunned) { stun = srcUnit.GetStun().Clone(); } if (slowed) { slow = srcUnit.GetSlow().Clone(); } if (dotted) { dot = srcUnit.GetDot().Clone(); } }
//public string despGeneral=""; public UnitStat(){ stun=new Stun(); crit=new Critical(); slow=new Slow(); dot=new Dot(); buff=new Buff(); }
public Stun Clone() { Stun stun = new Stun(); stun.chance = chance; stun.duration = duration; return(stun); }
public UnitStat() { stun = new Stun(); crit = new Critical(); slow = new Slow(); dot = new Dot(); buff = new Buff(); }
public static Stun GetTowerStunMultiplier(int prefabID) { if (instance == null) { return(new Stun(0, 0)); } Stun stunG = instance.globalTowerModifier.stats.stun; Stun stunT = GetTowerModifier(prefabID).stats.stun; return(new Stun(stunG.chance + stunT.chance, stunG.duration + stunT.duration)); }
//shared among tower, ability . 0-tower, 2-ability public static Stun ModifyStunWithPerkBonus(Stun stun, int prefabID, int type = 0) { Stun stunMod = new Stun(); if (type == 0) { stunMod = GetTowerStunMultiplier(prefabID); } stun.chance *= (1 + stunMod.chance); stun.duration *= (1 + stunMod.duration); return(stun); }
public void Process(){ if(processed) return; processed=true; damage=Random.Range(srcUnit.GetDamageMin(), srcUnit.GetDamageMax()); damage/=(float)srcUnit.GetShootPointCount(); //divide the damage by number of shootPoint float critChance=srcUnit.GetCritChance(); if(tgtUnit.immuneToCrit) critChance=-1f; if(Random.Range(0f, 1f)<critChance){ critical=true; damage*=srcUnit.GetCritMultiplier(); } if(damage>=tgtUnit.shield){ damageShield=tgtUnit.shield; damageHP=damage-tgtUnit.shield; } else{ damageShield=damage; damageHP=0; } if(damageHP>=tgtUnit.HP){ destroy=true; return; } stunned=srcUnit.GetStun().IsApplicable(); if(tgtUnit.immuneToStun) stunned=false; slowed=srcUnit.GetSlow().IsValid(); if(tgtUnit.immuneToSlow) slowed=false; if(srcUnit.GetDot().GetTotalDamage()>0) dotted=true; if(stunned) stun=srcUnit.GetStun().Clone(); if(slowed) slow=srcUnit.GetSlow().Clone(); if(dotted) dot=srcUnit.GetDot().Clone(); }
public string GetDespStats() { if (!IsTower() || stats[currentActiveStat].useCustomDesp) { return(stats[currentActiveStat].desp); } UnitTower tower = unitT; string text = ""; if (tower.type == _TowerType.Turret || tower.type == _TowerType.AOE) { float currentDmgMin = GetDamageMin(); float currentDmgMax = GetDamageMax(); if (currentDmgMax > 0) { if (currentDmgMin == currentDmgMax) { text += "데미지: "+ currentDmgMax.ToString("f0"); } else { text += "데미지: "+ currentDmgMin.ToString("f0") + "-" + currentDmgMax.ToString("f0"); } } float currentAOE = GetAOERadius(); if (currentAOE > 0) { text += " (범위공격)"; } //if(currentAOE>0) text+="\nAOE Radius: "+currentAOE; float critChance = GetCritChance(); if (critChance > 0) { text += "\n크리티컬: "+ (critChance * 100).ToString("f0") + "%"; } if (text != "") { text += "\n"; } Stun stun = GetStun(); if (stun.IsValid()) { text += "\n기절 확률"; } Slow slow = GetSlow(); if (slow.IsValid()) { text += "\n대상 둔화"; } Dot dot = GetDot(); float dotDmg = dot.GetTotalDamage(); //if(dotDmg>0) text+="\n발사 "+dotDmg.ToString("f0")+" 안에 "+dot.duration.ToString("f0")+"초"; } else if (tower.type == _TowerType.Support) { Buff buff = GetBuff(); if (buff.damageBuff > 0) { text += "데미지 버프: " + ((buff.damageBuff) * 100).ToString("f0") + "%"; } if (buff.cooldownBuff > 0) { text += "\n쿨타임 버프: " + ((buff.cooldownBuff) * 100).ToString("f0") + "%"; } if (buff.rangeBuff > 0) { text += "\n범위 버프: " + ((buff.rangeBuff) * 100).ToString("f0") + "%"; } if (buff.criticalBuff > 0) { text += "\n범위 버프: " + ((buff.criticalBuff) * 100).ToString("f0") + "%"; } if (text != "") { text += "\n"; } if (buff.regenHP > 0) { float regenValue = buff.regenHP; float regenDuration = 1; if (buff.regenHP < 1) { regenValue = 1; regenDuration = 1 / buff.regenHP; } text += "\nRegen " + regenValue.ToString("f0") + "HP every " + regenDuration.ToString("f0") + "s"; } } return(text); }
//shared among tower, ability & fpsWeapon. 0-tower, 1-fpsWeapon, 2-ability public static Stun ModifyStunWithPerkBonus(Stun stun, int prefabID, int type=0){ Stun stunMod=new Stun(); if(type==0) stunMod=GetTowerStunMultiplier(prefabID); else if(type==1) stunMod=GetFPSWeaponStunMultiplier(prefabID); stun.chance*=(1+stunMod.chance); stun.duration*=(1+stunMod.duration); return stun; }
public string GetDespStats() { //return ""; if (stats[currentActiveStat].useCustomDesp) { return(stats[currentActiveStat].desp); } string text = ""; if (type == _TowerType.Turret || type == _TowerType.AOE || type == _TowerType.Mine) { float currentDmgMin = GetDamageMin(); float currentDmgMax = GetDamageMax(); if (currentDmgMax > 0) { if (currentDmgMin == currentDmgMax) { text += "Damage: "+ currentDmgMax.ToString("f0"); } else { text += "Damage: "+ currentDmgMin.ToString("f0") + "-" + currentDmgMax.ToString("f0"); } } float currentAOE = GetAOERadius(); if (currentAOE > 0) { text += " (AOE)"; } //if(currentAOE>0) text+="\nAOE Radius: "+currentAOE; if (type != _TowerType.Mine) { float currentCD = GetCooldown(); if (currentCD > 0) { text += "\nCooldown: "+ currentCD.ToString("f1") + "s"; } } //~ float critChance=GetCritChance(); //~ if(critChance>0) text+="\nCritical: "+(critChance*100).ToString("f0")+"%"; if (text != "") { text += "\n"; } if (GetCritChance() > 0) { text += "\n" + (GetCritChance() * 100).ToString("f0") + "% Chance to score critical hit"; } Stun stun = GetStun(); if (stun.IsValid()) { text += "\n" + (stun.chance * 100).ToString("f0") + "% Chance to stuns target"; } Slow slow = GetSlow(); if (slow.IsValid()) { text += "\nSlows target for " + slow.duration.ToString("f1") + " seconds"; } Dot dot = GetDot(); float dotDmg = dot.GetTotalDamage(); if (dotDmg > 0) { text += "\nDamage target by " + dotDmg.ToString("f0") + " over " + dot.duration.ToString("f0") + "s"; } if (DamageShieldOnly()) { text += "\nDamage target's shield only"; } if (GetShieldBreak() > 0) { text += "\n" + (GetShieldBreak() * 100).ToString("f0") + "% Chance to break shield"; } if (GetShieldPierce() > 0) { text += "\n" + (GetShieldPierce() * 100).ToString("f0") + "% Chance to pierce shield"; } InstantKill instKill = GetInstantKill(); if (instKill.IsValid()) { text += "\n" + (instKill.chance * 100).ToString("f0") + "% Chance to kill target instantly"; } } else if (type == _TowerType.Support) { Buff buff = GetBuff(); if (buff.damageBuff > 0) { text += "Damage Buff: " + ((buff.damageBuff) * 100).ToString("f0") + "%"; } if (buff.cooldownBuff > 0) { text += "\nCooldown Buff: " + ((buff.cooldownBuff) * 100).ToString("f0") + "%"; } if (buff.rangeBuff > 0) { text += "\nRange Buff: " + ((buff.rangeBuff) * 100).ToString("f0") + "%"; } if (buff.criticalBuff > 0) { text += "\nRange Buff: " + ((buff.criticalBuff) * 100).ToString("f0") + "%"; } if (buff.hitBuff > 0) { text += "\nHit Buff: " + ((buff.hitBuff) * 100).ToString("f0") + "%"; } if (buff.dodgeBuff > 0) { text += "\nDodge Buff: " + ((buff.dodgeBuff) * 100).ToString("f0") + "%"; } if (text != "") { text += "\n"; } if (buff.regenHP > 0) { float regenValue = buff.regenHP; float regenDuration = 1; if (buff.regenHP < 1) { regenValue = 1; regenDuration = 1 / buff.regenHP; } text += "\nRegen " + regenValue.ToString("f0") + "HP every " + regenDuration.ToString("f0") + "s"; } } else if (type == _TowerType.Resource) { text += "Regenerate resource overtime"; } return(text); }
private Stun ModifyStunWithPerkBonus(Stun stun) { return IsTower() ? PerkManager.ModifyStunWithPerkBonus(stun.Clone(), unitT.prefabID) : stun; }
//stats processing for attack from fps-weapon public void Process_SrcWeapon(){ if(srcWeapon.GetInstantKill().IsApplicable(tgtUnit.HP, tgtUnit.fullHP)){ damage=tgtUnit.HP; damageHP=tgtUnit.HP; instantKill=true; destroy=true; return; } damage=Random.Range(srcWeapon.GetDamageMin(), srcWeapon.GetDamageMax()); damage/=(float)srcWeapon.GetShootPointCount(); //divide the damage by number of shootPoint float critChance=srcWeapon.GetCritChance(); if(tgtUnit.immuneToCrit) critChance=-1f; if(Random.Range(0f, 1f)<critChance){ critical=true; damage*=srcWeapon.GetCritMultiplier(); //new TextOverlay(impactPoint, "Critical", new Color(1f, .6f, 0f, 1f)); } float dmgModifier=DamageTable.GetModifier(tgtUnit.armorType, srcWeapon.damageType); damage*=dmgModifier; if(damage>=tgtUnit.shield){ damageShield=tgtUnit.shield; damageHP=damage-tgtUnit.shield; } else{ damageShield=damage; damageHP=0; } if(Random.Range(0f, 1f)<srcWeapon.GetShieldPierce() && damageShield>0){ damageHP+=damageShield; damageShield=0; pierceShield=true; //new TextOverlay(impactPoint,"Shield Pierced", new Color(0f, 1f, 1f, 1f)); } if(srcWeapon.DamageShieldOnly()) damageHP=0; if(damageHP>=tgtUnit.HP){ destroy=true; return; } if(Random.Range(0f, 1f)<srcWeapon.GetShieldBreak() && tgtUnit.fullShield>0) breakShield=true; stunned=srcWeapon.GetStun().IsApplicable(); if(tgtUnit.immuneToStun) stunned=false; slowed=srcWeapon.GetSlow().IsValid(); if(tgtUnit.immuneToSlow) slowed=false; if(srcWeapon.GetDot().GetTotalDamage()>0) dotted=true; if(stunned) stun=srcWeapon.GetStun().Clone(); if(slowed) slow=srcWeapon.GetSlow().Clone(); if(dotted) dot=srcWeapon.GetDot().Clone(); }
//stats processing for attack from fps-weapon public void Process_SrcWeapon() { if (srcWeapon.GetInstantKill().IsApplicable(tgtUnit.HP, tgtUnit.fullHP)) { damage = tgtUnit.HP; damageHP = tgtUnit.HP; instantKill = true; destroy = true; return; } damage = Random.Range(srcWeapon.GetDamageMin(), srcWeapon.GetDamageMax()); damage /= (float)srcWeapon.GetShootPointCount(); //divide the damage by number of shootPoint float critChance = srcWeapon.GetCritChance(); if (tgtUnit.immuneToCrit) { critChance = -1f; } if (Random.Range(0f, 1f) < critChance) { critical = true; damage *= srcWeapon.GetCritMultiplier(); //new TextOverlay(impactPoint, "Critical", new Color(1f, .6f, 0f, 1f)); } float dmgModifier = DamageTable.GetModifier(tgtUnit.armorType, srcWeapon.damageType); damage *= dmgModifier; if (damage >= tgtUnit.shield) { damageShield = tgtUnit.shield; damageHP = damage - tgtUnit.shield; } else { damageShield = damage; damageHP = 0; } if (Random.Range(0f, 1f) < srcWeapon.GetShieldPierce() && damageShield > 0) { damageHP += damageShield; damageShield = 0; pierceShield = true; //new TextOverlay(impactPoint,"Shield Pierced", new Color(0f, 1f, 1f, 1f)); } if (srcWeapon.DamageShieldOnly()) { damageHP = 0; } if (damageHP >= tgtUnit.HP) { destroy = true; return; } if (Random.Range(0f, 1f) < srcWeapon.GetShieldBreak() && tgtUnit.fullShield > 0) { breakShield = true; } stunned = srcWeapon.GetStun().IsApplicable(); if (tgtUnit.immuneToStun) { stunned = false; } slowed = srcWeapon.GetSlow().IsValid(); if (tgtUnit.immuneToSlow) { slowed = false; } if (srcWeapon.GetDot().GetTotalDamage() > 0) { dotted = true; } if (stunned) { stun = srcWeapon.GetStun().Clone(); } if (slowed) { slow = srcWeapon.GetSlow().Clone(); } if (dotted) { dot = srcWeapon.GetDot().Clone(); } }
public void Process() { if (processed) { return; } processed = true; damage = Random.Range(srcUnit.GetDamageMin(), srcUnit.GetDamageMax()); damage /= (float)srcUnit.GetShootPointCount(); //divide the damage by number of shootPoint float critChance = srcUnit.GetCritChance(); if (tgtUnit.immuneToCrit) { critChance = -1f; } if (Random.Range(0f, 1f) < critChance) { critical = true; damage *= srcUnit.GetCritMultiplier(); } if (damage >= tgtUnit.shield) { damageShield = tgtUnit.shield; damageHP = damage - tgtUnit.shield; } else { damageShield = damage; damageHP = 0; } if (damageHP >= tgtUnit.HP) { destroy = true; return; } stunned = srcUnit.GetStun().IsApplicable(); if (tgtUnit.immuneToStun) { stunned = false; } slowed = srcUnit.GetSlow().IsValid(); if (tgtUnit.immuneToSlow) { slowed = false; } if (srcUnit.GetDot().GetTotalDamage() > 0) { dotted = true; } if (stunned) { stun = srcUnit.GetStun().Clone(); } if (slowed) { slow = srcUnit.GetSlow().Clone(); } if (dotted) { dot = srcUnit.GetDot().Clone(); } }
private Stun ModifyStunWithPerkBonus(Stun stun) { return(IsTower() ? PerkManager.ModifyStunWithPerkBonus(stun.Clone(), prefabID) : stun); }
//stats processing for attack from unit (tower/creep) public void Process_SrcUnit() { if (srcUnit.GetHit() <= 0) { Debug.LogWarning("Attacking unit (" + srcUnit.unitName + ") has default hitChance of 0%, is this intended?", srcUnit); } float hitChance = Mathf.Clamp(srcUnit.GetHit() - tgtUnit.GetDodge(), 0, 1); if (Random.Range(0f, 1f) > hitChance) { missed = true; return; } if (srcUnit.GetInstantKill().IsApplicable(tgtUnit.HP, tgtUnit.GetFullHP())) { damage = tgtUnit.HP; damageHP = tgtUnit.HP; instantKill = true; destroy = true; return; } damage = Random.Range(srcUnit.GetDamageMin(), srcUnit.GetDamageMax()); damage /= (float)srcUnit.GetShootPointCount(); //divide the damage by number of shootPoint float critChance = srcUnit.GetCritChance(); if (tgtUnit.immuneToCrit) { critChance = -1f; } if (Random.Range(0f, 1f) < critChance) { critical = true; damage *= srcUnit.GetCritMultiplier(); //new TextOverlay(impactPoint, "Critical", new Color(1f, .6f, 0f, 1f)); } float dmgModifier = DamageTable.GetModifier(tgtUnit.armorType, srcUnit.damageType); damage *= dmgModifier; if (damage >= tgtUnit.shield) { damageShield = tgtUnit.shield; damageHP = damage - tgtUnit.shield; } else { damageShield = damage; damageHP = 0; } if (Random.Range(0f, 1f) < srcUnit.GetShieldPierce() && damageShield > 0) { damageHP += damageShield; damageShield = 0; pierceShield = true; //new TextOverlay(impactPoint,"Shield Pierced", new Color(0f, 1f, 1f, 1f)); } if (srcUnit.DamageShieldOnly()) { damageHP = 0; } if (damageHP >= tgtUnit.HP) { destroy = true; return; } if (Random.Range(0f, 1f) < srcUnit.GetShieldBreak() && tgtUnit.defaultShield > 0) { breakShield = true; } stunned = srcUnit.GetStun().IsApplicable(); if (tgtUnit.immuneToStun) { stunned = false; } slowed = srcUnit.GetSlow().IsValid(); if (tgtUnit.immuneToSlow) { slowed = false; } if (srcUnit.GetDot().GetTotalDamage() > 0) { dotted = true; } if (stunned) { stun = srcUnit.GetStun().Clone(); } if (slowed) { slow = srcUnit.GetSlow().Clone(); } if (dotted) { dot = srcUnit.GetDot().Clone(); } }
public Stun Clone(){ Stun stun=new Stun(); stun.chance=chance; stun.duration=duration; return stun; }
public string GetDespStats() { if (!IsTower() || stats[currentActiveStat].useCustomDesp) { return(stats[currentActiveStat].desp); } UnitTower tower = unitT; string text = ""; if (tower.type == _TowerType.Turret || tower.type == _TowerType.AOE || tower.type == _TowerType.Mine) { float currentDmgMin = GetDamageMin(); float currentDmgMax = GetDamageMax(); if (currentDmgMax > 0) { if (currentDmgMin == currentDmgMax) { text += "Damage: "+ currentDmgMax.ToString("f0"); } else { text += "Damage: "+ currentDmgMin.ToString("f0") + "-" + currentDmgMax.ToString("f0"); } } float currentAOE = GetAOERadius(); if (currentAOE > 0) { text += " (AOE)"; } if (tower.type != _TowerType.Mine) { float currentCD = GetCooldown(); if (currentCD > 0) { text += "\nCooldown: "+ currentCD.ToString("f1") + "s"; } } float critChance = GetCritChance(); if (critChance > 0) { text += "\nCritical: "+ (critChance * 100).ToString("f0") + "%"; } if (text != "") { text += "\n"; } Stun stun = GetStun(); if (stun.IsValid()) { text += "\nChance to stuns target"; } Slow slow = GetSlow(); if (slow.IsValid()) { text += "\nSlows target"; } Dot dot = GetDot(); float dotDmg = dot.GetTotalDamage(); if (dotDmg > 0) { text += "\nDeal " + dotDmg.ToString("f0") + " over " + dot.duration.ToString("f0") + "s"; } } else if (tower.type == _TowerType.Support) { Buff buff = GetBuff(); if (buff.damageBuff > 0) { text += "Damage Buff: " + ((buff.damageBuff) * 100).ToString("f0") + "%"; } if (buff.cooldownBuff > 0) { text += "\nCooldown Buff: " + ((buff.cooldownBuff) * 100).ToString("f0") + "%"; } if (buff.rangeBuff > 0) { text += "\nRange Buff: " + ((buff.rangeBuff) * 100).ToString("f0") + "%"; } if (buff.criticalBuff > 0) { text += "\nRange Buff: " + ((buff.criticalBuff) * 100).ToString("f0") + "%"; } if (text != "") { text += "\n"; } if (buff.regenHP > 0) { float regenValue = buff.regenHP; float regenDuration = 1; if (buff.regenHP < 1) { regenValue = 1; regenDuration = 1 / buff.regenHP; } text += "\nRegen " + regenValue.ToString("f0") + "HP every " + regenDuration.ToString("f0") + "s"; } } else if (tower.type == _TowerType.Resource) { text += "Regenerate resource overtime"; } return(text); }
public string GetDespStats() { if (!IsTower() || stats[currentActiveStat].useCustomDesp) { return(stats[currentActiveStat].desp); } UnitTower tower = unitT; string text = ""; if (tower.type == _TowerType.Turret || tower.type == _TowerType.AOE) { float currentDmgMin = GetDamageMin(); float currentDmgMax = GetDamageMax(); if (currentDmgMax > 0) { if (currentDmgMin == currentDmgMax) { text += "Damage: "+ currentDmgMax.ToString("f0"); } else { text += "Damage: "+ currentDmgMin.ToString("f0") + "-" + currentDmgMax.ToString("f0"); } } float currentAOE = GetAOERadius(); if (currentAOE > 0) { text += " (AOE)"; } //if(currentAOE>0) text+="\nAOE Radius: "+currentAOE; float critChance = GetCritChance(); if (critChance > 0) { text += "\nCritical: "+ (critChance * 100).ToString("f0") + "%"; } if (text != "") { text += "\n"; } Stun stun = GetStun(); if (stun.IsValid()) { text += "\nChance to stuns target"; } Slow slow = GetSlow(); if (slow.IsValid()) { text += "\nSlows target"; } Dot dot = GetDot(); float dotDmg = dot.GetTotalDamage(); if (dotDmg > 0) { text += "\nDamage " + dotDmg.ToString("f0") + " over " + dot.duration.ToString("f0") + "sec"; } } else if (tower.type == _TowerType.Support) { Buff buff = GetBuff(); if (buff.damageBuff > 0) { text += "Damage Buff: " + ((buff.damageBuff) * 100).ToString("f0") + "%"; } if (buff.cooldownBuff > 0) { text += "\nCooldown Buff: " + ((buff.cooldownBuff) * 100).ToString("f0") + "%"; } if (buff.rangeBuff > 0) { text += "\nRange Buff: " + ((buff.rangeBuff) * 100).ToString("f0") + "%"; } if (buff.criticalBuff > 0) { text += "\nRange Buff: " + ((buff.criticalBuff) * 100).ToString("f0") + "%"; } if (text != "") { text += "\n"; } if (buff.regenHP > 0) { float regenValue = buff.regenHP; float regenDuration = 1; if (buff.regenHP < 1) { regenValue = 1; regenDuration = 1 / buff.regenHP; } text += "\nRegen " + regenValue.ToString("f0") + "HP every " + regenDuration.ToString("f0") + "s"; } } else if (tower.type == _TowerType.Electric) { if (GetMaxElectricity() > 0) { text += "Max electricity stored: " + GetMaxElectricity().ToString(); } if (GetElectricityRegenerationRate() > 0) { text += "\nElectricity generated: " + GetElectricityRegenerationRate().ToString() + " per sec"; } if (GetElectricityReceiveRate() > 0) { text += "\nElectricity Transfer Rate: " + GetElectricityReceiveRate().ToString(); } if (GetCurrentElectricity() > 0) { text += "\nElectricity available: " + GetCurrentElectricity().ToString(); } } return(text); }