Skip to content

Added Psychic Frog AI logic for blocking and attacking#9978

Open
NathanRoy1 wants to merge 4 commits intoCard-Forge:masterfrom
NathanRoy1:AI-doesn't-activate-first-ability-of-Psychic-Frog
Open

Added Psychic Frog AI logic for blocking and attacking#9978
NathanRoy1 wants to merge 4 commits intoCard-Forge:masterfrom
NathanRoy1:AI-doesn't-activate-first-ability-of-Psychic-Frog

Conversation

@NathanRoy1
Copy link
Contributor

Implements SpecialCardAi.PsychicFrog to handle both activated abilities of Psychic Frog.
Ability 1 — Discard a card: put a +1/+1 counter on Psychic Frog

Activates during combat when the Frog is blocking and the counter would prevent it from dying or allow it to kill an attacker it otherwise couldn't
Activates proactively at end of turn when 2+ safe discard candidates are available, or when hand size exceeds the maximum hand size limit

Ability 2 — Exile three cards from graveyard: Psychic Frog gains flying until end of turn
Activates on opponent's turn to intercept unblocked flyers, preferring blocks where the Frog survives and kills the attacker
Will use any graveyard cards if life is in danger
Activates on the AI's turn to attack unblocked when the opponent has no flying/reach blockers, with a higher priority score when the attack is lethal

SVar:TrigDraw:DB$ Draw | Defined$ You | NumCards$ 1
A:AB$ PutCounter | Cost$ Discard<1/Card> | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a +1/+1 counter on CARDNAME.
A:AB$ Pump | Cost$ ExileFromGrave<3/Card> | Defined$ Self | KW$ Flying | SpellDescription$ CARDNAME gains flying until end of turn.
A:AB$ PutCounter | Cost$ Discard<1/Card> | CounterType$ P1P1 | CounterNum$ 1 | AILogic$ PsychicFrog | SpellDescription$ Put a +1/+1 counter on CARDNAME.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, thanks for contributing

imo these abilities aren't really unusual enough to warrant their own logic:

  • technically Pump/PutCounter should both already have some logic for combat tricks that could be improved (so more cards can benefit)
  • so it's probably more about when paying those cost parts is worth it, for that check ComputerUtil.getCardPreference for more flexible approach

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, it’s not that you think the logic isn’t worth implementing. Rather, you’d prefer to integrate this behavior directly into PumpAi and PutCounterAi so that a larger range of cards can benefit from the improved logic.

Given that, what would you prefer for this PR? Should it be closed for now or would you like this implementation to remain as a temporary solution until the more generalized logic is added?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well if you want to rework it feel free to just add further commits

But if you'd rather start fresh later closing might be better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should be able to rework it in a short delay so I'll leave it open for now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually kind of like this "isolated special logic" approach, at least until this can be generalized/rewritten (SpecialCardAi was created with that in mind - a place to put specialized/tricky logic until it can be made generic in the proper API-based AIs). If this can't be rewritten in a reasonable time frame to be generic, I vote for integrating this version for the time being, as it seems to perform well. The only thing I'd also vote for is that it's cleaned up a bit if possible (it reformats some stuff and adds some extraneous empty lines in some places unrelated to the PR - I'll mark those places separately in the review)

@tool4ever tool4ever linked an issue Mar 3, 2026 that may be closed by this pull request
return SpecialCardAi.PsychicFrog.considerCounterAbility(ai, sa , ph);
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded extra empty line

} else if (logic.equals("TheOneRing")) {
return SpecialCardAi.TheOneRing.consider(ai, sa);
}else if ("PsychicFrog".equals(logic)) {
return SpecialCardAi.PsychicFrog.considerCounterAbility(ai, sa , ph);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ai, sa, ph
(without the extra space after "sa")

@Override
protected boolean checkPhaseRestrictions(final Player ai, final SpellAbility sa, final PhaseHandler ph,
final String logic) {
final String logic) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substandard style (we usually don't format it like that)


private boolean pumpTgtAI(final Player ai, final SpellAbility sa, final int defense, final int attack, final boolean mandatory,
boolean immediately) {
boolean immediately) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substandard style (we usually don't format it like that)

@Agetian
Copy link
Contributor

Agetian commented Mar 20, 2026

It also looks like the compile is failing due to a missing import in SpecialCardAi?

@Agetian
Copy link
Contributor

Agetian commented Mar 20, 2026

It also looks like the compile is failing due to a missing import in SpecialCardAi?

Fixed this. Should now compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI doesn't activate first ability of Psychic Frog

3 participants