Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OnSpSummoned #202

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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