Skip to content

Commit

Permalink
Merge pull request #20 from NinjaTertel/fireball-am
Browse files Browse the repository at this point in the history
Added P2 Fireball AM and fixed Tenstrike/GrandOctet IDs.
  • Loading branch information
paissaheavyindustries authored Nov 27, 2023
2 parents e4d4dbf + a314b65 commit f878b3c
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 7 deletions.
101 changes: 94 additions & 7 deletions Lemegeton/Content/UltUcob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Lemegeton.Core;
using System.Collections.Generic;
using System.Linq;
using static Lemegeton.Content.UltOmegaProtocol;
using System.Collections;

namespace Lemegeton.Content
Expand All @@ -16,16 +15,19 @@ internal class UltUcob : Core.Content
private const int AbilityChainLighting = 0x26c7;
private const int AbilityTenstrikeTrio = 9958;
private const int AbilityGigaflare = 9942;
private const int AbilityTwistingDive = 9906;
private const int AbilityTwistingDive = 0x2A;
private const int AbilityFireballCast = 9925;
private const int StatusThunderstruck = 466;
private const int HeadmarkerEarthshaker = 28;
private const int HeadmarkerHatch = 76;
private const int HeadmarkerLunarDive = 77;
private const int HeadmarkerCauterize = 14;
private const int HeadmarkerMegaflareDive = 29;
private const int HeadmarkerHatch = 0x76;
private const int HeadmarkerEarthshaker = 0x28;
private const int HeadmarkerLunarDive = 0x77;
private const int HeadmarkerCauterize = 0x14;
private const int HeadmarkerMegaflareDive = 0x29;
private const int TetherFireball = 5;

private bool ZoneOk = false;

private FireballAm _fireballAm;
private ChainLightningAm _chainLightningAm;
private TenstrikeAm _tenstrikeAm;
private GrandOctetAm _grandOctetAm;
Expand Down Expand Up @@ -55,6 +57,75 @@ private PhaseEnum CurrentPhase
}
}

#region FireballAm

public class FireballAm : Automarker
{

[AttributeOrderNumber(1000)]
public AutomarkerSigns Signs { get; set; }

[DebugOption]
[AttributeOrderNumber(2500)]
public AutomarkerTiming Timing { get; set; }

[DebugOption]
[AttributeOrderNumber(3000)]
public System.Action Test { get; set; }

private uint _fireballTarget;

public FireballAm(State state) : base(state)
{
Enabled = false;
AsSoftmarker = true; // Client-side only marker by default.
Timing = new AutomarkerTiming() { TimingType = AutomarkerTiming.TimingTypeEnum.Inherit, Parent = state.cfg.DefaultAutomarkerTiming };
Signs = new AutomarkerSigns();
Signs.SetRole("FireballTarget", AutomarkerSigns.SignEnum.Triangle, false);
Test = new System.Action(() => Signs.TestFunctionality(state, null, Timing, SelfMarkOnly, AsSoftmarker));
}

public override void Reset()
{
Log(State.LogLevelEnum.Debug, null, "Reset");
_fireballTarget = 0;
}

internal void FeedTether(uint actorId, uint actionId)
{
if (Active == false)
{
return;
}

Log(State.LogLevelEnum.Debug, null, "Registered tether {0} on {1:X}", actionId, actorId);
_fireballTarget = actorId;
Party.PartyMember fireballGo = _state.GetPartyMembers().GetByActorId(_fireballTarget);

Log(State.LogLevelEnum.Debug, null, "Ready for automarker.");
AutomarkerPayload ap = new AutomarkerPayload(_state, SelfMarkOnly, AsSoftmarker);
ap.Assign(Signs.Roles["FireballTarget"], fireballGo.GameObject);
_state.ExecuteAutomarkers(ap, Timing);
}

internal void FeedAction(uint actorId, uint actionId)
{
if (Active == false || _fireballTarget == 0)
{
return;
}

// If the target currently has lightning when the fire tether resolves, it will also clear that marker on them.
// Possible enhancement on the future to add this compatability.
Log(State.LogLevelEnum.Debug, null, "Clearing automarkers.");
Party.PartyMember fireballGo = _state.GetPartyMembers().GetByActorId(_fireballTarget);
_state.ClearMarkerOn(fireballGo.GameObject, true, true);
}

}

#endregion

#region ChainLightningAm

public class ChainLightningAm : Automarker
Expand Down Expand Up @@ -195,6 +266,7 @@ internal void FeedHeadmarker(uint actorId, uint headMarkerId)
{
return;
}

Log(State.LogLevelEnum.Debug, null, "Registered headMarkerId {0} on {1:X}", headMarkerId, actorId);
switch (headMarkerId)
{
Expand Down Expand Up @@ -357,11 +429,20 @@ protected override bool ExecutionImplementation()

private void SubscribeToEvents()
{
_state.OnTether += OnTether;
_state.OnHeadMarker += OnHeadMarker;
_state.OnAction += _state_OnAction;
_state.OnStatusChange += _state_OnStatusChange;
}

private void OnTether(uint src, uint dest, uint tetherId)
{
if (tetherId == TetherFireball)
{
_fireballAm.FeedTether(dest, tetherId);
}
}

private void OnHeadMarker(uint dest, uint markerId)
{
if (CurrentPhase == PhaseEnum.Tenstrike)
Expand All @@ -388,6 +469,10 @@ private void _state_OnAction(uint src, uint dest, ushort actionId)
{
_chainLightningAm.FeedAction(dest, actionId);
}
if (actionId == AbilityFireballCast)
{
_fireballAm.FeedAction(dest, actionId);
}
if (actionId == AbilityTenstrikeTrio)
{
CurrentPhase = PhaseEnum.Tenstrike;
Expand Down Expand Up @@ -418,6 +503,7 @@ private void _state_OnAction(uint src, uint dest, ushort actionId)

private void UnsubscribeFromEvents()
{
_state.OnTether -= OnTether;
_state.OnHeadMarker -= OnHeadMarker;
_state.OnStatusChange -= _state_OnStatusChange;
_state.OnAction -= _state_OnAction;
Expand All @@ -443,6 +529,7 @@ private void OnZoneChange(ushort newZone)
if (newZoneOk == true && ZoneOk == false)
{
Log(State.LogLevelEnum.Info, null, "Content available");
_fireballAm = (FireballAm)Items["FireballAm"];
_chainLightningAm = (ChainLightningAm)Items["ChainLightningAm"];
_tenstrikeAm = (TenstrikeAm)Items["TenstrikeAm"];
_grandOctetAm = (GrandOctetAm)Items["GrandOctetAm"];
Expand Down
7 changes: 7 additions & 0 deletions Lemegeton/Language/English.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ internal class English : Core.Language

public English(State st) : base(st)
{
AddEntry("Content/Ultimate/UltUcob/FireballAm", "(P2) Fireball automarker");
AddEntry("Content/Ultimate/UltUcob/FireballAm/Enabled", "Enabled");
AddEntry("Content/Ultimate/UltUcob/FireballAm/SelfMarkOnly", "Self-marking only");
AddEntry("Content/Ultimate/UltUcob/FireballAm/AsSoftmarker", "Show as client-side soft markers");
AddEntry("Content/Ultimate/UltUcob/FireballAm/Signs", "Marker configuration");
AddEntry("Content/Ultimate/UltUcob/FireballAm/Signs/FireballTarget", "Fireball target");
AddEntry("Content/Ultimate/UltUcob/FireballAm/Test", "Test random assignment");
#region 1.0.2.2
AddEntry("Content/Ultimate/UltUcob/GrandOctetAm", "(P3) Grand Octet Twintania Dive automarker");
AddEntry("Content/Ultimate/UltUcob/GrandOctetAm/Enabled", "Enabled");
Expand Down

0 comments on commit f878b3c

Please sign in to comment.