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 Heal(Entities t){
		//GameObject tar = gm.localPlayer.GetComponent<PlayerHandler> ().Target;
		if (t != null) {
			//Entities t = tar.GetComponent<Entities> (); // Figure out how abstract works better
			
			// i.Special is to check if percentage is used. Special is a bool to indicate a special case.
			// This section checks what item type it is, then goes ahead and does the appropriate calculations.
			// t is the PlayerHandler script of the targeted player.
			// Maybe add healing enemy functionality?

			if ((ItemType)type == ItemType.HP) {
				if (Special) {
					// Divided by 100f because if it were only by 100 it would not work. It needs to be read as a float.
					t.setHp((int)((Amt / 100f) * t.MaxHp));
				} else {
					t.setHp(Amt);
				}
			} else if ((ItemType)type == ItemType.MP) {
				if (Special) {
					t.setMp((int)((Amt / 100f) * t.MaxMp));
				} else {
					t.setMp(Amt);
				}
			}
			Quantity -= 1;
		} else {
			Debug.Log("Target is not valid!");
		}
	}
Exemplo n.º 3
0
	public void dealDamage(int dmg, Entities tar){
		tar.setHp(-dmg);
	}