示例#1
0
		public void TakeDamage(ActiveUnit user, Ability ability){

			//Calculate damage
			uint damage = ability.Damage (user);
			if (stats.DEF/2 >= damage)
				damage = 1;
			else {
				damage -= stats.DEF/2;
				damage = ((uint)Math.Ceiling(((double)damage) * DamageModifier()));
			}

			double hitchance = HitChance (user, ability);

			bool HIT = Ability.R.NextDouble () <= hitchance;

			if (HIT) { //Attack hits

				double critchance = ((((double)user.stats.LUK) - ((double)stats.LUK))
					/ 100) + .03;
				if (critchance < .03)
					critchance = .03;
				else if (critchance > .25)
					critchance = .25;
				critchance *= ability.CritChance;
				bool CRIT = Ability.R.NextDouble () <= critchance;

				if (CRIT) {
					Utility.WriteLine ("%%%%% CRITICAL HIT! (" + critchance + ") %%%%%");
					Utility.WriteLine ("%%%%% " + this.name +
						" TAKES " + damage + " DAMAGE (" + hitchance + ") %%%%%\n");

					damage = (uint)(((double)damage) * 2);
					
					if (damage > currenthealth) {
						currenthealth = 0;
					} else {
						currenthealth -= damage;
					}
				} else {
					Utility.WriteLine ("%%%%% " + this.name +
						" TAKES " + damage + " DAMAGE (" + hitchance + ") %%%%%\n");

					if (damage > currenthealth) {
						currenthealth = 0;
					} else {
						currenthealth -= damage;
					}
				}
			} else { //Attack misses
				Utility.WriteLine ("%%%%% ATTACK MISSED! (" + hitchance + ") %%%%%\n");
			}
		}
示例#2
0
		public void HealDamage(ActiveUnit user, Ability ability){
			//Calculate damage
			uint damage = ability.Damage (user);

			currenthealth += damage;
			if (currenthealth > stats.HP)
				currenthealth = stats.HP;

			Utility.WriteLine ("%%%%% " + this.name +
				" HEALS " + damage + " DAMAGE %%%%%\n");
		}
示例#3
0
		public abstract uint Damage(ActiveUnit user);
示例#4
0
		private double HitChance(ActiveUnit user, Ability ability){
			double hitchance = 1;
			if(user.stats.ACC != 0){
				hitchance = (( ((double)user.stats.ACC) * 1.1 - ((double)stats.AGI)*.25)
					/ (double)user.stats.ACC) * ability.Accuracy;
			}
			//Cap hitchance at 95%
			if (hitchance > .95)
				hitchance = .95;
			else if (hitchance < .4)
				hitchance = .4;

			return hitchance;
		}
示例#5
0
		public void UsageEffect(ActiveUnit user, ActiveUnit target){
			UsageEffect_Inner (user, target);
			currentcooldown = cooldown;
		}
示例#6
0
		public abstract void UsageEffect_Inner(ActiveUnit user, ActiveUnit target);
示例#7
0
		public override uint Damage(ActiveUnit user){
			return user.Stats.ATK;
		}
示例#8
0
		public override void UsageEffect_Inner(ActiveUnit user, ActiveUnit target){
			target.TakeDamage (user, this);
		}
示例#9
0
		public override uint Damage(ActiveUnit user){
			return (uint)(user.Stats.DEF*1.5 + user.Stats.LUK*.5);
		}
示例#10
0
		public override uint Damage(ActiveUnit user){
			return (uint)(user.Stats.ATK*1.7);
		}
示例#11
0
		public void ExecuteAbility(Ability ability,
			ActiveUnit user, ActiveUnit target){
			Utility.WriteLine ("\n%%%%% " + user.Name + " USES "
				+ ability.Name + " ON " + target.Name + " %%%%%\n");
			ability.UsageEffect (user, target);
		}