Exemplo n.º 1
0
	public void skillAction(Entities user, Entities[] tar, bool hit){
		
		if (MpCost > 0 && HpCost > 0) {
			if (user.getHp() >= HpCost) {
				user.setHp(-HpCost);
			} else {
				Debug.Log ("Not enough HP!");
				return;
			}
			if (user.getMp() >= MpCost) {
				user.setMp(-MpCost);
			} else {
				Debug.Log ("Not enough MP!");
				return;
			}
		} else if (HpCost > 0) {
			if (user.getHp() >= HpCost) {
				user.setHp(-HpCost);
			} else {
				Debug.Log ("Not enough HP!");
				return;
			}
		} else if (MpCost > 0) {
			if (user.getMp() >= MpCost) {
				user.setMp(-MpCost);
			} else {
				Debug.Log ("Not enough MP!");
				return;
			}
		}

		// If it hit, do damage.
		if (hit) {
			if (DamageType == damage_type.single) {
				if (DamageEffect == damage_effect.hp) {
					tar [0].setHp(-(Damage - (tar [0].End / 3)));
				} else if (DamageEffect == damage_effect.mp) {
					tar [0].setMp( -(Damage - (tar [0].End / 3)));
				} else {
					Debug.Log ("TURN DAMAGER NOT IMPLEMENTED YET");
				}
			} else if (DamageType == damage_type.aoe) {
				foreach (Entities e in tar) {
					if (DamageEffect == damage_effect.hp) {
						e.setHp(-(Damage - (e.End / 3)));
					} else if (DamageEffect == damage_effect.mp) {
						e.setMp( -(Damage - (e.End / 3)));
					} else {
						Debug.Log ("TURN DAMAGER NOT IMPLEMENTED YET");
					}
				}
			} else if (DamageType == damage_type.dot) {
				Debug.Log ("Turn based effects not implemented yet");	
			}
			user.Damage = Damage;
		}
	}
Exemplo n.º 2
0
	public void checkSkillAction(Entities user, Entities[] tar){
		if (MpCost > 0 && HpCost > 0) {
			if (user.getHp() < HpCost) {
				//user.Hp -= HpCost;
				Debug.Log ("Not enough HP!");
				return;
			}
			if (user.getMp() < MpCost) {
				Debug.Log ("Not enough MP!");
				return;
			}
		} else if (HpCost > 0) {
			if (user.getHp() < HpCost) {
				Debug.Log ("Not enough HP!");
				return;
			}
		} else if (MpCost > 0) {
			if (user.getMp() < MpCost) {
				Debug.Log ("Not enough MP!");
				return;
			}
		}

		//After all the checks to see if the user can use the skill...

		user.setSkill (tar);
		user.handleSelectedSkill = SkillDatabase.GetSkillByUniqueName(UniqueName);
		//skillAction (user, tar);
	}