Beispiel #1
0
 /// <summary>
 /// Make damage to the whole team
 /// </summary>
 /// <param name="damage">Attack roll</param>
 /// <param name="type">Type of saving throw</param>
 /// <param name="difficulty">Difficulty</param>
 public void Damage(Dice damage, SavingThrowType type, int difficulty)
 {
     foreach (Hero hero in Heroes)
     {
         if (hero != null)
         {
             hero.Damage(damage, type, difficulty);
         }
     }
 }
Beispiel #2
0
        public static AbilityEffectRunAction CreateAbilityEffectRunAction(SavingThrowType save = SavingThrowType.Unknown, params GameAction[] actions)
        {
            if (actions == null || actions[0] == null)
            {
                throw new ArgumentNullException();
            }
            var result = ScriptableObject.CreateInstance <AbilityEffectRunAction>();

            result.SavingThrowType = save;
            result.Actions         = new ActionList()
            {
                Actions = actions
            };
            return(result);
        }
Beispiel #3
0
        //{
        //    if (attack == null)
        //        return;

        //    LastAttack = attack;
        //    if (LastAttack.IsAMiss)
        //        return;

        //    HitPoint.Current -= LastAttack.Hit;

        //    // Reward the team for having killed the entity
        //    if (IsDead && attack.Striker is Hero)
        //    {
        //        (attack.Striker as Hero).Team.AddExperience(Reward);
        //    }
        //}


        /// <summary>
        /// Make damage to the hero
        /// </summary>
        /// <param name="damage">Attack roll</param>
        /// <param name="type">Type of saving throw</param>
        /// <param name="difficulty">Difficulty</param>
        public void Damage(Dice damage, SavingThrowType type, int difficulty)
        {
            if (damage == null)
            {
                return;
            }

            int save = Dice.GetD20(1);

            // No damage
            if (save == 20 || save + SavingThrow(type) > difficulty)
            {
                return;
            }

            HitPoint.Current -= damage.Roll();
        }
Beispiel #4
0
        /// <summary>
        /// Returns the result of a saving throw
        /// </summary>
        /// <param name="type">Type of throw</param>
        /// <returns>Saving throw value</returns>
        public int SavingThrow(SavingThrowType type)
        {
            int ret = BaseSaveBonus;

            switch (type)
            {
            case SavingThrowType.Fortitude:
                ret += Constitution.Modifier;
                break;

            case SavingThrowType.Reflex:
                ret += Dexterity.Modifier;
                break;

            case SavingThrowType.Will:
                ret += Wisdom.Modifier;
                break;
            }

            ret += Dice.GetD20(1);

            return(ret);
        }
Beispiel #5
0
 public static Effect SavingThrowIncrease(SavingThrow savingThrow, int amount, SavingThrowType savingThrowType = SavingThrowType.All)
 => NWScript.EffectSavingThrowIncrease((int)savingThrow, amount, (int)savingThrowType);
Beispiel #6
0
 public static void setSavingThrow(this AbilityEffectRunAction effectAndRun, SavingThrowType savingThrow)
 {
     effectAndRun.SavingThrowType = savingThrow;
 }
Beispiel #7
0
        //public static GameAction getAction(this AbilityEffectRunAction effectAndRun) { return effectAndRun.Actions.Actions[0]; }

        /// <param name="savingThrow">SavingThrowType.Unknown means "None"</param>
        public static void setSavingThrow(this BlueprintAbility ability, SavingThrowType savingThrow)
        {
            ability.GetComponent <AbilityEffectRunAction>().SavingThrowType = savingThrow;
        }
        public static void runActionOnDamageDealt(RuleDealDamage evt, ActionList action, int min_dmg = 1, bool only_critical = false, SavingThrowType save_type = SavingThrowType.Unknown,
                                                  BlueprintBuff context_buff = null, DamageEnergyType energy_descriptor      = DamageEnergyType.Acid, bool use_damage_energy_type = false)
        {
            if (only_critical && (evt.AttackRoll == null || !evt.AttackRoll.IsCriticalConfirmed))
            {
                return;
            }


            var target = evt.Target;

            if (target == null)
            {
                return;
            }

            if (evt.Damage <= min_dmg)
            {
                return;
            }

            if (use_damage_energy_type)
            {
                bool damage_found = false;
                foreach (var dmg in evt.DamageBundle)
                {
                    var energy_damage = (dmg as EnergyDamage);

                    if (energy_damage != null && energy_damage.EnergyType == energy_descriptor)
                    {
                        damage_found = true;
                        break;
                    }
                }

                if (!damage_found)
                {
                    return;
                }
            }

            if (save_type != SavingThrowType.Unknown)
            {
                var context_params = evt.Initiator.Buffs?.GetBuff(context_buff)?.MaybeContext?.Params;
                if (context_params == null)
                {
                    return;
                }

                var dc = context_params.DC;
                var rule_saving_throw = new RuleSavingThrow(target, save_type, dc);
                Rulebook.Trigger(rule_saving_throw);

                if (rule_saving_throw.IsPassed)
                {
                    return;
                }
            }

            var context_fact = evt.Initiator.Buffs?.GetBuff(context_buff);

            (context_fact as IFactContextOwner)?.RunActionInContext(action, target);
        }
Beispiel #9
0
		/// <summary>
		/// Returns the result of a saving throw
		/// </summary>
		/// <param name="type">Type of throw</param>
		/// <returns>Saving throw value</returns>
		public int SavingThrow(SavingThrowType type)
		{
			int ret = BaseSaveBonus;

			switch (type)
			{
				case SavingThrowType.Fortitude:
				ret += Constitution.Modifier;
				break;
				case SavingThrowType.Reflex:
				ret += Dexterity.Modifier;
				break;
				case SavingThrowType.Will:
				ret += Wisdom.Modifier;
				break;
			}

			ret += Dice.GetD20(1);

			return ret;
		}
Beispiel #10
0
		//{
		//    if (attack == null)
		//        return;

		//    LastAttack = attack;
		//    if (LastAttack.IsAMiss)
		//        return;

		//    HitPoint.Current -= LastAttack.Hit;

		//    // Reward the team for having killed the entity
		//    if (IsDead && attack.Striker is Hero)
		//    {
		//        (attack.Striker as Hero).Team.AddExperience(Reward);
		//    }
		//}


		/// <summary>
		/// Make damage to the hero
		/// </summary>
		/// <param name="damage">Attack roll</param>
		/// <param name="type">Type of saving throw</param>
		/// <param name="difficulty">Difficulty</param>
		public void Damage(Dice damage, SavingThrowType type, int difficulty)
		{
			if (damage == null)
				return;

			int save = Dice.GetD20(1);

			// No damage
			if (save == 20 || save + SavingThrow(type) > difficulty)
				return;

			HitPoint.Current -= damage.Roll();

		}
Beispiel #11
0
		/// <summary>
		/// Make damage to the whole team
		/// </summary>
		/// <param name="damage">Attack roll</param>
		/// <param name="type">Type of saving throw</param>
		/// <param name="difficulty">Difficulty</param>
		public void Damage(Dice damage, SavingThrowType type, int difficulty)
		{
			foreach (Hero hero in Heroes)
				if (hero != null)
					hero.Damage(damage, type, difficulty);
		}
Beispiel #12
0
 public static Effect SavingThrowDecrease(SavingThrow savingThrow, int amount, SavingThrowType savingThrowType = SavingThrowType.All)
 {
     return(NWScript.EffectSavingThrowDecrease((int)savingThrow, amount, (int)savingThrowType) !);
 }
Beispiel #13
0
 public static bool SavingThrowSpell(this GameObject obj, int dc, SavingThrowType saveType,
                                     D20SavingThrowFlag flags,
                                     GameObject caster, int spellId)
 {
     return(GameSystems.D20.Combat.SavingThrowSpell(obj, caster, dc, saveType, flags, spellId));
 }
Beispiel #14
0
 public static bool SavingThrow(this GameObject obj, int dc, SavingThrowType saveType,
                                D20SavingThrowFlag flags,
                                GameObject opponent = null)
 {
     return(GameSystems.D20.Combat.SavingThrow(obj, opponent, dc, saveType, flags));
 }
Beispiel #15
0
 /// <summary>
 /// Gets a Saving Throw result
 /// </summary>
 /// <param name="type">Type of saving throw</param>
 /// <returns></returns>
 static public int SavingThrow(SavingThrowType type)
 {
     return(0);
 }
Beispiel #16
0
		/// <summary>
		/// Gets a Saving Throw result
		/// </summary>
		/// <param name="type">Type of saving throw</param>
		/// <returns></returns>
		static public int SavingThrow(SavingThrowType type)
		{
			return 0;
		}