User:MomBun/Sandbox: Difference between revisions

684 bytes added ,  12:02, 5 August 2022
 
Line 173: Line 173:
{
{


    /// <summary>
    ///  FlamingHands powers the "Flaming Ray" mutation.  You can now choose a variant from hands, feet or face.
    /// </summary>
     [Serializable]
     [Serializable]
     public class FlamingHands : BaseDefaultEquipmentMutation
     public class FlamingHands : BaseDefaultEquipmentMutation
     {
     {
        public FlamingHands()
        {
            DisplayName = "Flaming Ray";
        }


        /// <summary>The <see cref="BodyPart.Type" /> we replace (chosen by variant selection.)</summary>
         public string BodyPartType = "Hands";
         public string BodyPartType = "Hands";
        /// <summary>Do we still need to create the object? Setup as a public for serialization purposes.</summary>
         public bool CreateObject = true;
         public bool CreateObject = true;
        /// <summary>Sound file to play when attacking.</summary>
         public string Sound = "Abilities/sfx_ability_mutation_flamingRay_attack";
         public string Sound = "Abilities/sfx_ability_mutation_flamingRay_attack";
        [NonSerialized] private static GameObject _Projectile;


         public Guid FlamingHandsActivatedAbilityID = Guid.Empty;
         /// <summary>Create or retrive the already created Projectile game object.</summary>
 
        [NonSerialized] private static GameObject _Projectile;
         private static GameObject Projectile
         private static GameObject Projectile
         {
         {
Line 195: Line 205:
             }
             }
         }
         }
 
        /// <summary>We are request to be re-mutated automatically when our body is rebuilt. Thanks slog.</summary>
         public override bool GeneratesEquipment()
         public override bool GeneratesEquipment()
         {
         {
             return true;
             return true;
        }
        public FlamingHands()
        {
            DisplayName = "Flaming Ray";
         }
         }


Line 214: Line 219:
         }
         }


        /// <summary>Show selected variant in character creation.</summary>
         public override string GetCreateCharacterDisplayName()
         public override string GetCreateCharacterDisplayName()
         {
         {
Line 232: Line 238:
         }
         }


         public override string GetLevelText(int Level)
         public override string GetLevelText(int level)
         {
         {
             string Ret = "Emits a 9-square ray of flame in the direction of your choice.\n";             
             string Ret = "Emits a 9-square ray of flame in the direction of your choice.\n";             
             Ret += "Damage: {{rules|" + ComputeDamage(Level) + "}}\n";
             Ret += "Damage: {{rules|" + ComputeDamage(level) + "}}\n";
             Ret += "Cooldown: 10 rounds\n";
             Ret += "Cooldown: 10 rounds\n";
             Ret += "Melee attacks heat opponents by {{rules|" + GetHeatOnHitAmount(Level) + "}} degrees";
             Ret += "Melee attacks heat opponents by {{rules|" + GetHeatOnHitAmount(level) + "}} degrees";
             return Ret;
             return Ret;
         }
         }


         public string GetHeatOnHitAmount(int Level)
         public string GetHeatOnHitAmount(int level)
         {
         {
             return (Level * 2) + "d8";
             return (level * 2) + "d8";
         }
         }


         public string ComputeDamage(int UseLevel)
         public string ComputeDamage(int level)
         {
         {
             string Result = UseLevel + "d4";
             string Result = level + "d4";
             if (ParentObject != null)
             if (ParentObject != null)
             {
             {
Line 264: Line 270:
         }
         }


         public string ComputeDamage()
         public string ComputeDamage() => ComputeDamage(Level);
        {
            return ComputeDamage(Level);
        }


         public void Flame(Cell C, ScreenBuffer Buffer, bool doEffect = true)
         public void Flame(Cell C, ScreenBuffer Buffer, bool doEffect = true)
Line 354: Line 357:
                 }
                 }
             }
             }
             mutation.CooldownMyActivatedAbility(mutation.FlamingHandsActivatedAbilityID, Turns: 10);
             mutation.CooldownMyActivatedAbility(mutation.ActivatedAbilityID, Turns: 10);
             mutation.UseEnergy(1000, "Physical Mutation Flaming Hands");
             mutation.UseEnergy(1000, "Physical Mutation Flaming Hands");
             mutation.PlayWorldSound(mutation.Sound, combat: true);
             mutation.PlayWorldSound(mutation.Sound, combat: true);
Line 377: Line 380:
         {
         {
             if( !CreateObject) return true;
             if( !CreateObject) return true;
             return HasRegisteredSlot(BodyPartType) && GetRegisteredSlot(BodyPartType,false) != null;
             return HasRegisteredSlot(BodyPartType) && GetRegisteredSlot(BodyPartType, false) != null;
         }
         }


Line 407: Line 410:
                     CheckObjectProperlyEquipped()
                     CheckObjectProperlyEquipped()
                     && E.GetIntParameter("Distance") <= 9
                     && E.GetIntParameter("Distance") <= 9
                     && IsMyActivatedAbilityAIUsable(FlamingHandsActivatedAbilityID)
                     && IsMyActivatedAbilityAIUsable(ActivatedAbilityID)
                     && ParentObject.HasLOSTo(E.GetGameObjectParameter("Target"), UseTargetability: true)
                     && ParentObject.HasLOSTo(E.GetGameObjectParameter("Target"), UseTargetability: true)
                 )
                 )
Line 431: Line 434:
             }
             }
             return base.FireEvent(E);
             return base.FireEvent(E);
        }
        public override bool ChangeLevel(int NewLevel)
        {
            return base.ChangeLevel(NewLevel);
         }
         }


         private void AddAbility()
         private void AddAbility()
         {
         {
             FlamingHandsActivatedAbilityID = AddMyActivatedAbility(
             ActivatedAbilityID = AddMyActivatedAbility(
                 Name: "Flaming Ray",
                 Name: "Flaming Ray",
                 Command: "CommandFlamingHands",
                 Command: "CommandFlamingHands",
                 Class: "Physical Mutation",
                 Class: "Physical Mutation",
                 Icon: "" + (char) 168
                 Icon: "" + (char) 168,
                Description: GetLevelText(Level)
             );
             );
        }
        public override bool ChangeLevel(int NewLevel)
        {
            var result = base.ChangeLevel(NewLevel);
            // Update the ability description
            if (MyActivatedAbility(ActivatedAbilityID) is ActivatedAbilityEntry ability) ability.Description = GetLevelText(Level);
            return result;
         }
         }


Line 454: Line 461:
             return variants;
             return variants;
         }
         }


         public override void SetVariant(int n)
         public override void SetVariant(int n)
Line 467: Line 473:
             }
             }
             base.SetVariant(n);
             base.SetVariant(n);
        }
        public override void OnRegenerateDefaultEquipment(Body body)
        {
            base.OnRegenerateDefaultEquipment(body);
         }
         }


Line 543: Line 544:
         public override bool Unmutate(GameObject GO)
         public override bool Unmutate(GameObject GO)
         {
         {
             RemoveMyActivatedAbility(ref FlamingHandsActivatedAbilityID);
             RemoveMyActivatedAbility(ref ActivatedAbilityID);
             return base.Unmutate(GO);
             return base.Unmutate(GO);
         }
         }
Line 550: Line 551:


}
}
</syntaxhighlight>
</syntaxhighlight>




{{Modding Navbox}}
{{Modding Navbox}}