Skip to content

Commit

Permalink
Add Accepted behavior to Divine and Tuk.
Browse files Browse the repository at this point in the history
  • Loading branch information
homothetyhk committed Jan 16, 2022
1 parent e386118 commit 32c35ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ItemChanger/Locations/SpecialLocations/DivineLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ protected override void OnReplace(GameObject obj, Container c)

private bool ShouldGiveItem()
{
return PlayerData.instance.GetBool("equippedCharm_" + requiredCharmID) && !Placement.AllObtained();
return PlayerData.instance.GetBool("equippedCharm_" + requiredCharmID) && !Placement.CheckVisitedAny(VisitState.Accepted) && !Placement.AllObtained();
}

private bool ItemIsPooed()
{
return PlayerData.instance.GetBool("pooedFragile" + shopSlot.ToString()) && !Placement.AllObtained();
return Placement.CheckVisitedAny(VisitState.Accepted) && !Placement.AllObtained();
}

private Cost GetCost()
Expand Down Expand Up @@ -116,6 +116,7 @@ private void EditSlotSpecificPath(PlayMakerFSM fsm)
{
Cost c = GetCost();
if (c is not null && !c.Paid) c.Pay();
Placement.AddVisitFlag(VisitState.Accepted);
fsm.FsmVariables.FindFsmString("Pooed PD Bool").Value = "pooedFragile" + shopSlot.ToString();
fsm.FsmVariables.FindFsmGameObject("Charm To Spawn").Value = FindContainer(fsm, shopSlot);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ private void OverrideDeadTuk(PlayMakerFSM fsm)

private void OverrideTukConvo(PlayMakerFSM fsm)
{
FsmState init = fsm.GetState("Init");
FsmState convoChoice = fsm.GetState("Convo Choice");
FsmState dung = fsm.GetState("Dung");
FsmState eggMax = fsm.GetState("Egg Max");
FsmState give = fsm.GetState("Give");

FsmEvent dungEvent = FsmEvent.GetFsmEvent("DUNG");

init.AddTransition(FsmEvent.GetFsmEvent("EGG"), fsm.GetState("Give Pause"));
init.AddLastAction(new DelegateBoolTest(ShouldReappearOnFloor, FsmEvent.GetFsmEvent("EGG"), null));

convoChoice.Transitions = new FsmTransition[]
{
new(){ FsmEvent = dungEvent, ToFsmState = dung, ToState = dung.Name },
Expand All @@ -59,6 +63,8 @@ private void OverrideTukConvo(PlayMakerFSM fsm)
new DelegateBoolTest(ShouldGiveItem, FsmEvent.GetFsmEvent("DUNG"), null),
};

dung.AddLastAction(new Lambda(() => Placement.AddVisitFlag(VisitState.Accepted)));

give.Actions = new FsmStateAction[]
{
new Lambda(() => FlingShiny(fsm.FsmVariables.FindFsmGameObject("Egg Spawn").Value.transform.position)),
Expand All @@ -75,7 +81,12 @@ private void FlingShiny(Vector3 init)

private bool ShouldGiveItem()
{
return PlayerData.instance.GetBool("equippedCharm_" + requiredCharmID) && !Placement.AllObtained();
return PlayerData.instance.GetBool("equippedCharm_" + requiredCharmID) && !Placement.CheckVisitedAny(VisitState.Accepted) && !Placement.AllObtained();
}

private bool ShouldReappearOnFloor()
{
return Placement.CheckVisitedAny(VisitState.Accepted) && !Placement.AllObtained();
}

private void AddDefendersCrestReminder(ref string value)
Expand Down

0 comments on commit 32c35ae

Please sign in to comment.