public void PlayerStatUpdate() { if (player != null) { int hp = 500, atk = 300, def = 300, exp = 100; for (int i = 0; i < playerLevel; ++i) { hp += (int)(i * 7 + player.getDefend() * 0.1); atk += (int)(player.getAttack() * 0.1 + i * 15.7); def += (int)(i * 13 + player.getDefend() * 0.07); exp += (int)(i * 25.7 + 53); } player.setMaxHP(hp); player.setHP(hp); player.setAttack(atk); player.setDefend(def); player.setEXPtoLevelUP(exp); player.setLevel(playerLevel); player.setEXP(playerEXP); player.getLVtext().text = "LV." + (player.getLevel() + 1).ToString(); } }
public void Attack(ObjectMob mob) { ObjectPlayer player = PlayerManager.Inst().getPlayer(); Skill? skill = SkillManager.Inst().findSkill(Combination); int damage = 0; for (int i = 0; i < Combination.Length; ++i) { switch (Combination[i]) { case 'C': damage += (int)(player.getAttack() * 0.5f); break; case 'O': case 'H': damage += (int)(player.getAttack() * 0.25f); break; case 'S': case 'P': damage += (int)(player.getAttack() * 0.75f); break; } } if (skill.HasValue) { if (skill.Value.global) { var mobs = FindObjectsOfType <ObjectMob>(); foreach (var i in mobs) { if (i.gameObject.activeSelf) { if (Random.Range(0, 10) < mob.getLevel() - PlayerManager.Inst().getPlayer().getLevel()) { Debug.Log(i.name + "does not take any damage"); continue; //회피 } if ((int)(i.getType() + 1) % 3 == (int)skill.Value.type) { if (i.getStatusEffect() == StatusEffect.Burn) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5 * burnDamage)); } else if (i.getStatusEffect() == StatusEffect.Frostbite) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5 * freezeDamage)); } else { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5)); } Debug.Log(i.name + " is attacked and get " + (int)((skill.Value.damage + damage) * 1.5) + " damages"); } else if ((int)(i.getType() + 2) % 3 == (int)skill.Value.type) { if (i.getStatusEffect() == StatusEffect.Burn) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5 * burnDamage)); } else if (i.getStatusEffect() == StatusEffect.Frostbite) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5 * freezeDamage)); } else { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5)); } Debug.Log(i.name + " is attacked and get " + (int)((skill.Value.damage + damage) * 0.5) + " damages"); } else { if (i.getStatusEffect() == StatusEffect.Burn) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * burnDamage)); } else if (i.getStatusEffect() == StatusEffect.Frostbite) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * freezeDamage)); } else { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage))); } } if (skill.Value.statusEffect != StatusEffect.None) { if (Random.Range(0, 20) < 1) { i.setStatusEffect(skill.Value.statusEffect); i.setStatusRemainTurn(Random.Range(4, 8)); Debug.Log(i.name + " get " + skill.Value.statusEffect.ToString()); } } } } Debug.Log(mob.name + " is attacked and get " + damage.ToString() + " damages"); foreach (var i in mobs) { if (i.gameObject.activeSelf) { i.mobDead(); } } } else { if (Random.Range(0, 10) < mob.getLevel() - PlayerManager.Inst().getPlayer().getLevel()) { Debug.Log(mob.name + "does not take any damage"); } else { if ((int)(mob.getType() + 1) % 3 == (int)skill.Value.type) { if (mob.getStatusEffect() == StatusEffect.Burn) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5 * burnDamage)); } else if (mob.getStatusEffect() == StatusEffect.Frostbite) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5 * freezeDamage)); } else { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5)); } Debug.Log(mob.name + " is attacked and get " + (int)((skill.Value.damage + damage) * 1.5) + " damages"); } else if ((int)(mob.getType() + 2) % 3 == (int)skill.Value.type) { if (mob.getStatusEffect() == StatusEffect.Burn) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5 * burnDamage)); } else if (mob.getStatusEffect() == StatusEffect.Frostbite) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5 * freezeDamage)); } else { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5)); } Debug.Log(mob.name + " is attacked and get " + (int)((skill.Value.damage + damage) * 0.5) + " damages"); } else { if (mob.getStatusEffect() == StatusEffect.Burn) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * burnDamage)); } else if (mob.getStatusEffect() == StatusEffect.Frostbite) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * freezeDamage)); } else { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage))); } } if (skill.Value.statusEffect != StatusEffect.None) { if (Random.Range(0, 10) < 1) { mob.setStatusEffect(skill.Value.statusEffect); mob.setStatusRemainTurn(Random.Range(4, 8)); Debug.Log(mob.name + " get " + skill.Value.statusEffect.ToString()); } } mob.mobDead(); } } } else { if (Random.Range(0, 10) < mob.getLevel() - PlayerManager.Inst().getPlayer().getLevel()) { Debug.Log(mob.name + "does not take any damage"); } else { mob.GetDamaged(damage); Debug.Log(mob.name + " is attacked and get " + damage + " damages"); mob.mobDead(); } } SoundManager.Inst().playAudio(attack_sfx); while (PlayerManager.Inst().getPlayer().getEXP() >= PlayerManager.Inst().getPlayer().getEXPtoLevelUP()) { PlayerManager.Inst().levelUp(); } AttackReady = false; checkBattleState(); if (!InBattle) { endBattle(); } else { FindObjectOfType <ObjectPlayer>().getAnimator().SetTrigger("attack"); turnOver(); } }