Card-Forge / forge

An unofficial rules engine for the world's greatest card game.
https://card-forge.github.io/forge/
GNU General Public License v3.0
932 stars 543 forks source link

Arboria rework #5137

Open tool4ever opened 4 months ago

tool4ever commented 4 months ago
          This took a while since I was looking for some synergy with existing stuff ;)

Imo you could refactor it slightly to improve Arboria:

Creatures can’t attack a player unless that player cast a spell or put a nontoken permanent onto the battlefield during their last turn.

Currently both parts only work as bare minimum (static trigger counting) :/

For the casting check it might be easier to consolidate everything in a MagicStack Map <int turnNr, Spells> though. Player already stores a lastTurnNr, so with that you could just collect all the relevant entries?

I think we can still get away with periodic cleanup for memory, just the lower bound now being the minimum of each players last turn number (instead of the global last)

For the other check I was concerned we'd need to store additional cardsAddedLastTurn fields in Zone in the same way. However there's a subtle difference:

Arboria’s effect cares whether a player put a nontoken permanent onto the battlefield. It’s unusual for an ability to care who put a permanent onto the battlefield, as opposed to under whose control it entered.

This can matter if you look for effects like this:

When Petradon leaves the battlefield, return the exiled cards to the battlefield under their owners’ control.

➡️ Here the trigger controller moves the cards, but they can ETB under another.

Since this seems to be also pretty unique it might be easier to have this counted simply as boolean.

While changing this PR for that obscure World would be helpful, feel free to resolve via a new issue after (or even before hehe).

WDYT?

_Originally posted by @tool4ever in https://github.com/Card-Forge/forge/pull/4900#discussion_r1559687924_

tool4ever commented 4 months ago

It might be a bit more problematic than I thought since we can't just always check for the Cause controller instead. Some cards will make different players do the moving, e. g. Second Sunrise:

Each player returns to the battlefield all...

So looks like we'll need an additional param. But I'm not sure yet if one of the cases is more common, so that making it the default one would hopefully avoid lots of script adjustments 🤔

tool4ever commented 1 month ago

I stumbled upon Land Equilibrium:

This effect applies no matter how the land would enter the battlefield: because an opponent plays it, or because a spell or ability allows that opponent to put it onto the battlefield. Note that it doesn’t matter whose control the land enters the battlefield under. If the opponent would put the land onto the battlefield under someone else’s control (as a result of Yavimaya Dryad’s ability, for example), that opponent will still have to sacrifice a land.

@Fulgur14 do you know any other cards that need "Card Putter" info?

Fulgur14 commented 1 month ago

@tool4ever I'm not aware of it...