Page 141 of 253

Re: Community Wad

PostPosted: 28 Oct 2016, 14:36
by Xander9009
Splinterverse wrote:How do you get a card's complete mana cost (not its converted cost, but it's "original" cost, such as 1RR instead of 3).
There is no built-in function for doing so, although there are a few methods that work in nearly all cases. NeoAnderson wrote a function for it, which is this: Neo_ReturnManaString(oCard). It requires the existence of the _MANAGER_ABILITIES_ACTIVE manager, which means you need this code on any card that calls the function:
Code: Select all
<TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
   <TRIGGER value="BEGINNING_OF_STEP">
      return MTG():GetStep() == STEP_UPKEEP and MTG():GetTurnNumber() == 0
   </TRIGGER>
   <RESOLUTION_TIME_ACTION>
      CW_General_CreateManagers("_MANAGER_ABILITIES_ACTIVE")
   </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TOKEN_REGISTRATION reservation="1" type="_MANAGER_ABILITIES_ACTIVE" />

Re: Community Wad

PostPosted: 28 Oct 2016, 21:56
by Splinterverse
Finished coding for today; all cards referenced are from the missing cards list.

Coded, tested, and uploaded:
Æther Figment -- added kicker trigger and tested
Agonizing Demise -- added kicker trigger and tested
Anavolver -- added kicker trigger and tested
Apex Hawks -- added kicker trigger and tested
Arctic Merfolk -- added kicker trigger and tested
Ardent Soldier -- added kicker trigger and tested
Ashnod's Cylix
Bloodline Shaman
Coordinated Barrage
Disruption Aura
Distant Melody
Heart Wolf
Karona, False God
Kjeldoran Elite Guard
Luminescent Rain
Murmurs from Beyond
Orcish Veteran
Order of the Golden Cricket
Ovinomancer
Pack's Disdain
Pallimud
Parallectric Feedback
Paroxysm
Pearl Shard
Pedantic Learning
Peer Pressure
Pendrell Flux
Petals of Insight
Pious Kitsune

Bugs fixed:
Bull Elephant -- wasn't working properly
Loxodon Anchorite -- was preventing more than 2 damage
Phyrexian Grimoire -- minor tweak
Skyshroud War Beast -- was not filtering for opponent

HQ art uploaded (all were missing):
Heart Wolf
Heightened Awareness

Open Items:

-- CW_CARD_QUERY_SPLINTERVERSE has been updated and uploaded.

-- Does anyone know of a good example of card with a triggered ability that is available while it is in exile (other than the ability to cast it from exile)?

Next:

Back tomorrow to code through more missing cards.

Re: Community Wad

PostPosted: 28 Oct 2016, 22:17
by migookman
Great job in coding Splinterverse! How about cards with 'Suspend' to look at with its Triggered Ability from Exile?

Also, I'm still having problems with Zhalfirin Crusader even though Xander gave me good advice.
Code: Select all
       <COST mana_cost="{1}{W}" type="Mana" />
           <TARGET tag="CARD_QUERY_CHOOSE_TARGET_TO_REDIRECT_DAMAGE" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
                        filter:SetFilterType( FILTER_TYPE_CARDS + FILTER_TYPE_PLAYERS )
         filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         local target_creature = EffectDC():Get_Targets(0):Get_CardPtr(0)
               local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
         if target_creature ~= nil then
           local delayDC = EffectDC():Make_Chest(1)
            delayDC:Set_CardPtr(0, target_creature)
             MTG():CreateDelayedTrigger(25, delayDC)
           if target_player ~= nil then
            local delayDC = EffectDC():Make_Chest(1)
            delayDC:Set_PlayerPtr(0, target_player)
            MTG():CreateDelayedTrigger(25, delayDC)
         end
          end
      </RESOLUTION_TIME_ACTION>
   </ACTIVATED_ABILITY>
   <TRIGGERED_ABILITY resource_id="25" replacement_effect="1">
      <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_OBJECT" pre_trigger="1" damage_type="all">
         local TargetCard = EffectDC():Get_CardPtr(0)
         if TargetCard ~= nil then
            return TargetCard:GetCardType():Test(CARD_TYPE_CREATURE) and SecondaryObject() == EffectSource()
         else
            return false
         end
      </TRIGGER>
      <CLEANUP simple_cleanup="EndOfTurn" />
      <RESOLUTION_TIME_ACTION>
         local TargetCard = EffectDC():Get_CardPtr(0)
         if TargetCard ~= nil then
               Damage():RedirectAmountTo(1, TargetCard )
            end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
     <TRIGGERED_ABILITY resource_id="25" replacement_effect="1">
      <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_PLAYER" pre_trigger="1" damage_type="all">
         local TargetPlayer = EffectDC():Get_PlayerPtr(0)
         if TargetPlayer ~= nil then
            return TargetPlayer:EffectDC():Get_PlayerPtr(0) and SecondaryObject() == EffectSource()
         else
            return false
         end
      </TRIGGER>
      <CLEANUP simple_cleanup="EndOfTurn" />
      <RESOLUTION_TIME_ACTION>
         local TargetPlayer = EffectDC():Get_PlayerPtr(0)
         if TargetPlayer ~= nil then
               Damage():RedirectAmountTo(1, TargetPlayer )
            end
      </RESOLUTION_TIME_ACTION>
      <SFX text="GLOBAL_PREVENT_PLAY" />
   </TRIGGERED_ABILITY>

Re: Community Wad

PostPosted: 28 Oct 2016, 22:56
by Splinterverse
migookman wrote:Also, I'm still having problems with Zhalfirin Crusader even though Xander gave me good advice.
Maybe try changing the resource_id for one of the two, since you are using 25 for both. Other than that, I can't see anything wrong, but I haven't done anything with redirection yet, so I'm a novice in that area.

Re: Community Wad

PostPosted: 29 Oct 2016, 05:04
by tmxk2012917
After I cast Grapple with the Past, I could not return a land or creature from my graveyard.

As for Grim Flayer, he got +4/+0 rather than +2/+2

Re: Community Wad

PostPosted: 29 Oct 2016, 09:50
by thefiremind
migookman wrote:I'm still having problems with Zhalfirin Crusader even though Xander gave me good advice.
The second "if" in the code that creates the delayed triggers should be an "elseif". Either you do
Code: Select all
if ... then
    ...
elseif ... then
    ...
end
or
Code: Select all
if ... then
    ...
end
if ... then
    ...
end
but either way your code is missing something.
You should also use different resource_id's, because while it's true that only one of them is called each time, how does the game recognize which one to call if they are called the same? Alternatively you could make only 1 delayed trigger and discern between creature or player inside of it.

Oh and the CLEANUP should also have the fire_once="1" attribute, otherwise you'll keep redirecting 1 damage from all sources until the end of turn with just one activation.

Is <SFX text="GLOBAL_PREVENT_PLAY" /> useful? I think that replacement triggers can't show animations but I might be wrong there.

Re: Community Wad

PostPosted: 29 Oct 2016, 09:58
by Splinterverse
tmxk2012917 wrote:After I cast Grapple with the Past, I could not return a land or creature from my graveyard.

As for Grim Flayer, he got +4/+0 rather than +2/+2
I think I've found and fixed the issues on both of these. Will test them today as I code other cards and upload tonight if they are work.

Re: Community Wad

PostPosted: 29 Oct 2016, 10:18
by Splinterverse
What are the different parts of a filter condition as in filter:Add( FE_LUA_CONDITION, 1, EffectController(), EffectDC() )?

Could I use it to check the state of an opponent?

Re: Community Wad

PostPosted: 29 Oct 2016, 13:14
by Splinterverse
Another question, what is the equivalent of a DO...WHILE loop in DOTP 2014? Is it "repeating"="1"? If so, how do you handle a repeating loop where the number of times needed to repeat is unknown?

Re: Community Wad

PostPosted: 29 Oct 2016, 13:53
by thefiremind
Splinterverse wrote:What are the different parts of a filter condition as in filter:Add( FE_LUA_CONDITION, 1, EffectController(), EffectDC() )?

Could I use it to check the state of an opponent?
The number is the corresponding filter condition ID. I don't know what the other arguments do, and you can find places where EffectDC() is omitted, but I always put all the arguments, just in case.
What do you mean with "state"? Can you show an example of what you're trying to accomplish?

Splinterverse wrote:Another question, what is the equivalent of a DO...WHILE loop in DOTP 2014? Is it "repeating"="1"? If so, how do you handle a repeating loop where the number of times needed to repeat is unknown?
If you need to make a do...while, Lua has repeat...until (it's the same, but after "until" you'll write the stopping condition rather than the continuing condition). You need a RESOLUTION_TIME_ACTION with repeating="1" when you want to repeat your code while changing the state of the game between loop runs (state-based conditions are checked, answers to queries are evaluated, etc.).
Again, an example of what you're trying to accomplish would allow for a more accurate explanation.

By the way, I think that those questions would be more on-topic here (even if the topic has been dead for some time). Maybe there you'll also find answers to questions you haven't asked yet. :wink:

Re: Community Wad

PostPosted: 29 Oct 2016, 14:07
by Splinterverse
thefiremind wrote:
Splinterverse wrote:What are the different parts of a filter condition as in filter:Add( FE_LUA_CONDITION, 1, EffectController(), EffectDC() )?

Could I use it to check the state of an opponent?
The number is the corresponding filter condition ID. I don't know what the other arguments do, and you can find places where EffectDC() is omitted, but I always put all the arguments, just in case.
What do you mean with "state"? Can you show an example of what you're trying to accomplish?

Splinterverse wrote:Another question, what is the equivalent of a DO...WHILE loop in DOTP 2014? Is it "repeating"="1"? If so, how do you handle a repeating loop where the number of times needed to repeat is unknown?
If you need to make a do...while, Lua has repeat...until (it's the same, but after "until" you'll write the stopping condition rather than the continuing condition). You need a RESOLUTION_TIME_ACTION with repeating="1" when you want to repeat your code while changing the state of the game between loop runs (state-based conditions are checked, answers to queries are evaluated, etc.).
Again, an example of what you're trying to accomplish would allow for a more accurate explanation.

By the way, I think that those questions would be more on-topic here (even if the topic has been dead for some time). Maybe there you'll also find answers to questions you haven't asked yet. :wink:
I will definitely check out that thread when I have some time, and I'll try to post the coding only questions there going forward.

The first question I asked had to do with Oath of Scholars, Oath of Mages, etc. I've already coded these cards and am testing them today, but I wanted to add a lua condition to the opponent targeting so that only opponents that met the requirements could be targeted.

The second question had to do with cards like Crazed Firecat. When we enter the coin flipping process, we have no way of knowing how many flips it will take to "lose a flip," so I wasn't sure how to handle the n in the repeating RTA. It made me think of a do...while loop.

Re: Community Wad

PostPosted: 29 Oct 2016, 14:07
by Splinterverse
Splinterverse wrote:
thefiremind wrote:
Splinterverse wrote:What are the different parts of a filter condition as in filter:Add( FE_LUA_CONDITION, 1, EffectController(), EffectDC() )?

Could I use it to check the state of an opponent?
The number is the corresponding filter condition ID. I don't know what the other arguments do, and you can find places where EffectDC() is omitted, but I always put all the arguments, just in case.
What do you mean with "state"? Can you show an example of what you're trying to accomplish?

Splinterverse wrote:Another question, what is the equivalent of a DO...WHILE loop in DOTP 2014? Is it "repeating"="1"? If so, how do you handle a repeating loop where the number of times needed to repeat is unknown?
If you need to make a do...while, Lua has repeat...until (it's the same, but after "until" you'll write the stopping condition rather than the continuing condition). You need a RESOLUTION_TIME_ACTION with repeating="1" when you want to repeat your code while changing the state of the game between loop runs (state-based conditions are checked, answers to queries are evaluated, etc.).
Again, an example of what you're trying to accomplish would allow for a more accurate explanation.

By the way, I think that those questions would be more on-topic here (even if the topic has been dead for some time). Maybe there you'll also find answers to questions you haven't asked yet. :wink:
I will definitely check out that thread when I have some time, and I'll try to post the coding only questions there going forward.

The first question I asked had to do with Oath of Scholars, Oath of Mages, etc. I've already coded these cards and am testing them today, but I wanted to add a lua condition to the opponent targeting so that only opponents that meet the requirements can be targeted.

The second question had to do with cards like Crazed Firecat. When we enter the coin flipping process, we have no way of knowing how many flips it will take to "lose a flip," so I wasn't sure how to handle the n in the repeating RTA. It made me think of a do...while loop.

Re: Community Wad

PostPosted: 29 Oct 2016, 19:57
by Xander9009
For Crazed Firecat, yes, a repeating RTA is the right way to go.
Code: Select all
local oController = EffectController()
if oController ~= nil then
  if MTG():GetActionRepCount() % 2 == 0 then
    oController:FlipCoin()
    return true
  elseif oController:GetCoinFlipResult() == COIN_FLIP_WIN then
    EffectDC():Int_Inc(0)
    return true
  end
  return false
end
Note that I do not know the function calls for coin flips or the constant for a win off the top of my head, so those likely need to be corrected, but the idea/structure should work fine.

Re: Community Wad

PostPosted: 29 Oct 2016, 21:35
by Splinterverse
Finished coding for today; all cards referenced are from the missing cards list.

Coded, tested, and uploaded:
Alpha Authority
Benalish Emissary -- added kicker trigger and tested
Benalish Lancer -- added kicker trigger and tested
Bereavement
Blood Tribute -- added kicker trigger and tested
Bloodhusk Ritualist -- added kicker trigger and tested
Bog Down -- added kicker trigger and tested
Bold Defense -- added kicker trigger and tested
Breath of Darigaaz -- added kicker trigger and tested
Burst Lightning -- added kicker trigger and tested
Canopy Surge -- added kicker trigger and tested
Cetavolver -- added kicker trigger and tested
Citanul Woodreaders -- added kicker trigger and tested
Conjurer's Ban
Conqueror's Pledge -- added kicker trigger and tested
Emberwilde Djinn
Gloomlance
Grave Sifter
Harsh Mercy
Ley Line
Mask of Intolerance
Mogg Assassin
Molten Sentry
No Quarter
Noetic Scales
Oath of Ghouls
Oath of Mages
Oath of Scholars
Patriarch's Bidding
Risky Move
Tide of War

Bugs fixed:
Grapple with the Past -- was missing a parenthesis on a target call
Grim Flayer -- had incorrect + amounts in delirium buff

HQ art uploaded (all were missing):
Grapple with the Past
Grave Sifter
Grim Flayer
Harsh Mercy

Open Items:

-- CW_CARD_QUERY_SPLINTERVERSE has been updated and uploaded.

-- I added a couple posts to the Impossible Cards thread about a few cards that may have to be added to the impossible list.

-- Spreading Plague in the .wad is not working properly. I tested it multiple times and attempted a fix to no avail. I tested with monocolor cards to make sure it wasn't a multicolor issue. I suspect it has something to do with INTERSECTS being used in a filter block. I've never gotten that to work. The only card in the .wad that it seems to work on is Konda's Banner, which when you look at it, doesn't appear to be different. It is this issue that has prevented me from completing Crown of Awe, Crown of Suspicion, etc. I wish there was another way to query subtype. I've tried Get_Subtype() and looked through the S_ChooseCreatureType functions etc. EDIT TO ADD: Spreading Plague is destroying all creatures except the trigger creature, rather than all creatures that share a color with the trigger creature.

Next:

Back tomorrow to continue coding missing cards.

Re: Community Wad

PostPosted: 29 Oct 2016, 22:38
by Xander9009
Splinterverse wrote:Spreading Plague in the .wad is not working properly. I tested it multiple times and attempted a fix to no avail. I tested with monocolor cards to make sure it wasn't a multicolor issue. I suspect it has something to do with INTERSECTS being used in a filter block. I've never gotten that to work. The only card in the .wad that it seems to work on is Konda's Banner, which when you look at it, doesn't appear to be different. It is this issue that has prevented me from completing Crown of Awe, Crown of Suspicion, etc. I wish there was another way to query subtype. I've tried Get_Subtype() and looked through the S_ChooseCreatureType functions etc. EDIT TO ADD: Spreading Plague is destroying all creatures except the trigger creature, rather than all creatures that share a color with the trigger creature.
Fixed. The OP_INTERSECTS operation in a filter will determine the function it needs to call on the third parameter based on the first parameter. If the first parameter is FE_COLOUR, then it will call GetColour() on the third parameter. So, if GetColour() is called on it already, then it internally calls GetColour() on the colours, which doesn't work, and the function fails. If the first parameter is FE_SUBTYPE, it'll internally get the subtypes from the third parameter. In any case, the third parameter should be a card (or card's LKI), directly.

Many cards successfully use OP_INTERSECTS. Konda's Banner is just the only card in the CW that uses it with FE_COLOUR. The difference between the two is that Konda's Banner provided TriggerObjectLKI() as the third parameter, while Spreading Sickness was providing TriggerObjectLKI():GetColour() as the third parameter.