Example #1
0
 private static bool Prefix(UnitProgressionData __instance, int experience)
 {
     if (!settings.toggleAllowMythicPets)
     {
         return(true);
     }
     if (experience < 1)
     {
         PFLog.Default.Error(string.Format("Current mythic level of {0} is {1}, trying to raise to {2}! Aborting", (object)__instance.Owner, (object)__instance.MythicLevel, (object)(__instance.MythicExperience + experience)));
     }
     else
     {
         __instance.MythicExperience += experience;
         if (__instance.MythicExperience > 10)
         {
             PFLog.Default.Error(string.Format("Current mythic level of {0} is {1}, trying to raise to {2}! Can't do this", (object)__instance.Owner, (object)__instance.MythicLevel, (object)(__instance.MythicExperience + experience)));
         }
         var pair = UnitPartDualCompanion.GetPair(__instance.Owner.Unit);
         if (pair != (UnitDescriptor)null)
         {
             pair.Descriptor.Progression.MythicExperience = __instance.MythicExperience;
         }
         EventBus.RaiseEvent <IUnitGainMythicExperienceHandler>((Action <IUnitGainMythicExperienceHandler>)(h => h.HandleUnitGainMythicExperience(__instance.Owner, experience)));
     }
     return(false);
 }
Example #2
0
        public static void InstantRest()
        {
            var escMode = false;

            if (Game.Instance.CurrentMode == GameModeType.EscMode)
            {
                escMode = true;
                Game.Instance.UI.EscManager.OnEscPressed();
                Game.Instance.PauseBind();
            }

            var partyMembers = Game.Instance?.Player.ControllableCharacters;

            foreach (var u in partyMembers)
            {
                ApplyInstantRest(u);
                var pair = UnitPartDualCompanion.GetPair(u);
                if (pair != null)
                {
                    ApplyInstantRest(pair);
                }
            }

            if (escMode)
            {
                Game.Instance.PauseBind();
                Game.Instance.UI.EscManager.OnEscPressed();
            }
        }
Example #3
0
        public override void OnTrigger(RulebookEventContext context)
        {
            float multiplier = Modifier ?? 1f;
            int   healAmount = Math.Max(0, (int)((Dice.D(HealFormula) + Bonus) * multiplier));
            var   value      = Math.Min(healAmount, Target.Damage);

            setValue(this, value);
            Target.Damage -= value;
            Log.Write($"{GetType().Name}: healed {Target.CharacterName} for {Value} HP ({value}), damage now at: {Target.Damage}");
            UnitPartDualCompanion.HandleHealing(Target, healAmount);
            EventBus.RaiseEvent((IHealingHandler h) => h.HandleHealing(Initiator, Target, Value));
            var overflow = healAmount - Target.Damage;

            if (overflow > 0)
            {
                OverflowHealing = overflow;
            }
        }