Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk



Playing a permanent spell belonging to another player
Moderator: CCGHQ Admins
Playing a permanent spell belonging to another player
by thefiremind » 10 Jun 2012, 08:42
I'm trying to code Mindleech Mass, but there's a problem I would have never imagined.
By using either PlaySpellForFreeAtAnyTime or PlayFreeFromAnywhere, if the spell is a permanent, it enters the battlefield under its owner's control instead of mine!
I temporarily solved the problem by adding this trigger:
Did anyone experience this problem and found a more elegant solution?
By using either PlaySpellForFreeAtAnyTime or PlayFreeFromAnywhere, if the spell is a permanent, it enters the battlefield under its owner's control instead of mine!

I temporarily solved the problem by adding this trigger:
- Code: Select all
<TRIGGERED_ABILITY internal="1" pre_trigger="1" active_zone="any">
<TRIGGER value="COMES_INTO_PLAY">
if MTG():ObjectDataChest():Get_ProtectedCardPtr( 1 ) ~= nil and
TriggerObject() == MTG():ObjectDataChest():Get_ProtectedCardPtr( 1 ) and
TriggerObject():GetOwner() ~= Object():GetPlayer() and
TriggerObject():WasCast() ~= 0 then
local types = TriggerObject():GetCardType()
if (types:Test( CARD_TYPE_ARTIFACT ) ~= 0 or
types:Test( CARD_TYPE_ENCHANTMENT ) ~= 0 or
types:Test( CARD_TYPE_LAND ) ~= 0 or
types:Test( CARD_TYPE_CREATURE ) ~= 0 or
types:Test( CARD_TYPE_PLANESWALKER ) ~= 0) then
MTG():ObjectDataChest():Set_ProtectedCardPtr( 1, nil )
return true
end
end
return false
</TRIGGER>
<RESOLUTION_TIME_ACTION>
TriggerObject():SetPermanentController( Object():GetPlayer() )
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
Did anyone experience this problem and found a more elegant solution?
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
Re: Playing a permanent spell belonging to another player
by thefiremind » 25 Jun 2012, 21:32
This problem persists in DotP2013, and the old solution doesn't work anymore... maybe I'm doing something wrong with the new trigger specifications, I don't know. Anyway, if I make a Ninja deck, I won't be able to code Silent-Blade Oni. 

< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
Re: Playing a permanent spell belonging to another player
by GravitonGamer » 29 Jun 2012, 06:34
Have you tried PseudoPlaySpell? I've seen it on some cards but I haven't used it myself yet.
- GravitonGamer
- Posts: 15
- Joined: 18 Sep 2011, 04:21
- Has thanked: 7 times
- Been thanked: 7 times
Re: Playing a permanent spell belonging to another player
by thefiremind » 29 Jun 2012, 08:35
PseudoPlaySpell doesn't play the spell, but uses SPELL_ABILITY when there's one: it's made for Auras, so you can still choose what to enchant even if you didn't play them.GravitonGamer wrote:Have you tried PseudoPlaySpell? I've seen it on some cards but I haven't used it myself yet.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
Re: Playing a permanent spell belonging to another player
by Jspapp » 04 Jul 2012, 23:38
I've been playing around with this with not much luck.
Have you tried your earlier solution with SetPermanentController() inside of a <CONTINUOUS_ACTION> instead of a <RESOLUTION_TIME_ACTION> to make it work in 2013?
Have you tried your earlier solution with SetPermanentController() inside of a <CONTINUOUS_ACTION> instead of a <RESOLUTION_TIME_ACTION> to make it work in 2013?
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests