public void Damage(UnitGridCombat Attacker) { if (Attacker.GetComponent <CHARACTER_PREFS>().tipo == CHARACTER_PREFS.Tipo.MELEE) { attackID = 1; attackedByMelee = true; attackedByArcher = false; attackedByHealer = false; attackedByTank = false; attackedByMage = false; if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL1) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 25.0f + ((25.0f / 100.0f) * 55.0f); } else { damageAmount = 25.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL2) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 30.0f + ((30.0f / 100.0f) * 20.0f); } else { damageAmount = 30.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL3) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 35.0f + ((35.0f / 100.0f) * 20.0f); } else { damageAmount = 35.0f; } } } else if (Attacker.GetComponent <CHARACTER_PREFS>().tipo == CHARACTER_PREFS.Tipo.RANGED) { attackID = 2; attackedByMelee = false; attackedByArcher = true; attackedByHealer = false; attackedByTank = false; attackedByMage = false; if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL1) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 20.0f + ((20.0f / 100.0f) * 20.0f); } else { damageAmount = 20.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL2) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 25.0f + ((25.0f / 100.0f) * 20.0f); } else { damageAmount = 25.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL3) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 30.0f + ((30.0f / 100.0f) * 20.0f); } else { damageAmount = 30.0f; } } } else if (Attacker.GetComponent <CHARACTER_PREFS>().tipo == CHARACTER_PREFS.Tipo.HEALER) { attackedByMelee = false; attackedByArcher = false; attackedByHealer = true; attackedByTank = false; attackedByMage = false; if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL1) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 10.0f + ((10.0f / 100.0f) * 20.0f); } else { damageAmount = 10.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL2) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 15.0f + ((15.0f / 100.0f) * 20.0f); } else { damageAmount = 15.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL3) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 20.0f + ((20.0f / 100.0f) * 20.0f); } else { damageAmount = 20.0f; } } } else if (Attacker.GetComponent <CHARACTER_PREFS>().tipo == CHARACTER_PREFS.Tipo.TANK) { attackedByMelee = false; attackedByArcher = false; attackedByHealer = false; attackedByTank = true; attackedByMage = false; if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL1) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 15.0f + ((15.0f / 100.0f) * 20.0f); } else { damageAmount = 15.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL2) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 20.0f + ((20.0f / 100.0f) * 20.0f); } else { damageAmount = 20.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL3) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 25.0f + ((25.0f / 100.0f) * 20.0f); } else { damageAmount = 25.0f; } } } else if (Attacker.GetComponent <CHARACTER_PREFS>().tipo == CHARACTER_PREFS.Tipo.MAGE) { attackID = 3; attackedByMelee = false; attackedByArcher = false; attackedByHealer = false; attackedByTank = false; attackedByMage = true; if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL1) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 25.0f + ((25.0f / 100.0f) * 20.0f); } else { damageAmount = 25.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL2) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 30.0f + ((30.0f / 100.0f) * 20.0f); } else { damageAmount = 30.0f; } } else if (Attacker.GetComponent <CHARACTER_PREFS>().Getlevel() == CHARACTER_PREFS.Level.NIVEL3) { if (sceneCombatSystem.inspiredAttack) { damageAmount = 35.0f + ((35.0f / 100.0f) * 20.0f); } else { damageAmount = 35.0f; } } } float dmg; dmg = RandomDamage(damageAmount); sceneCombatSystem.DamagePopUp(this.GetPosition(), (int)dmg); healthSystem.Damage((int)dmg); if (healthSystem.IsDead()) { if (Attacker.GetTeam() == Team.Blue) { if (characterPrefs.Getlevel() == CHARACTER_PREFS.Level.NIVEL1) { if (attackedByMelee) { characterManager.meleeExp += 5; } if (attackedByArcher) { characterManager.archerExp += 5; } if (attackedByHealer) { characterManager.healerExp += 5; } if (attackedByTank) { characterManager.tankExp += 5; } if (attackedByMage) { characterManager.mageExp += 5; } } if (characterPrefs.Getlevel() == CHARACTER_PREFS.Level.NIVEL3) { if (attackedByMelee) { characterManager.meleeExp += 25; } if (attackedByArcher) { characterManager.archerExp += 25; } if (attackedByHealer) { characterManager.healerExp += 25; } if (attackedByTank) { characterManager.tankExp += 25; } if (attackedByMage) { characterManager.mageExp += 25; } } imDead = true; sceneCombatSystem.CheckIfDead(); for (int i = 0; i < sceneCombatSystem.enemiesTeamList.Count; i++) { if (!sceneCombatSystem.enemiesTeamList[i].imDead) { sceneCombatSystem.newEnemiesTeamList.Add(sceneCombatSystem.enemiesTeamList[i]); } } CleanListIA(); } else if (Attacker.GetTeam() == Team.Red) { imDead = true; sceneCombatSystem.CheckIfDead(); sceneCombatSystem.allydeads += 1; if (characterPrefs.getType() == CHARACTER_PREFS.Tipo.MELEE) { sceneCombatSystem.numberOfMeleeLeft--; } if (characterPrefs.getType() == CHARACTER_PREFS.Tipo.RANGED) { sceneCombatSystem.numberOfRangedLeft--; } if (characterPrefs.getType() == CHARACTER_PREFS.Tipo.HEALER) { sceneCombatSystem.numberOfHealerLeft--; } if (characterPrefs.getType() == CHARACTER_PREFS.Tipo.TANK) { sceneCombatSystem.numberOfTankLeft--; } if (characterPrefs.getType() == CHARACTER_PREFS.Tipo.MAGE) { sceneCombatSystem.numberOfMageLeft--; } for (int i = 0; i < sceneCombatSystem.alliesTeamList.Count; i++) { if (!sceneCombatSystem.alliesTeamList[i].imDead) { sceneCombatSystem.newAlliesTeamList.Add(sceneCombatSystem.alliesTeamList[i]); } } CleanListAlly(); } } StartCoroutine(FeedbackAttack(Attacker)); }
public bool IsEnemy(UnitGridCombat unitGridCombat) { return(unitGridCombat.GetTeam() != team); }