Skip to content

Commit

Permalink
Add OnSpSummoned (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wind2009-Louse authored Sep 23, 2024
1 parent b0a420e commit 64526e2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
17 changes: 16 additions & 1 deletion Game/AI/Decks/BlueEyesExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,22 @@ public override IList<ClientCard> OnSelectSynchroMaterial(IList<ClientCard> card
return null;
}

public override void OnSpSummoned()
{
// not special summoned by chain
if (Duel.GetCurrentSolvingChainCard() == null)
{
foreach (ClientCard card in Duel.LastSummonedCards)
{
if (card.Controller == 0 && card.IsCode(CardId.AlternativeWhiteDragon))
{
AlternativeWhiteDragonSummoned = true;
}
}
}
base.OnSpSummoned();
}

private bool DragonShrineEffect()
{
AI.SelectCard(
Expand Down Expand Up @@ -501,7 +517,6 @@ private bool WhiteStoneOfAncientsEffect()

private bool AlternativeWhiteDragonSummon()
{
AlternativeWhiteDragonSummoned = true;
return true;
}

Expand Down
10 changes: 10 additions & 0 deletions Game/AI/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,16 @@ public virtual int OnAnnounceCard(IList<int> avail)
return 0;
}

/// <summary>
/// Called when card is successfully special summoned.
/// Used on monsters that can only special summoned once per turn.
/// </summary>
public virtual void OnSpSummoned()
{
// For overriding
return;
}

public void SetMain(MainPhase main)
{
Main = main;
Expand Down
9 changes: 9 additions & 0 deletions Game/GameAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ public void OnChainSolved(int chainIndex)
{
Executor.OnChainSolved(chainIndex);
}

/// <summary>
/// Called when card is successfully special summoned.
/// Used on monsters that can only special summoned once per turn.
/// </summary>
public void OnSpSummoned()
{
Executor.OnSpSummoned();
}

/// <summary>
/// Called when a chain has been solved.
Expand Down
3 changes: 2 additions & 1 deletion Game/GameBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class GameBehavior
private Room _room;
private Duel _duel;
private int _hand;
private bool _debug;
private bool _debug;
private int _select_hint;
private GameMessage _lastMessage;

Expand Down Expand Up @@ -1971,6 +1971,7 @@ private void OnSpSummoned(BinaryReader packet)
card.IsSpecialSummoned = true;
_duel.LastSummonedCards.Add(card);
}
_ai.OnSpSummoned();
_duel.SummoningCards.Clear();
}

Expand Down

0 comments on commit 64526e2

Please sign in to comment.