Page 1 of 1

Enchanted Evening (couple of bugs)

PostPosted: 22 Nov 2012, 19:32
by Vervandi
I'm working on a new deck based around Enchanted Evening. My code is working pretty good with a couple of issues:

1. The card type text is replaced with COMPOUND_BASIC_TYPE_LAND(Creature/Artifact)_ENCHANTMENT. I'd rather it say something like "Land Enchantment" etc.

2. If I click on any creature, the game freezes. I can hit escape, exit from the menu, but I cannot continue the game. Here is the code I am using:

Code: Select all
<FILTER>
    return (FilteredCard() ~= nil and
    FilteredCard():GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0 or
   FilteredCard():GetCardType():Test( CARD_TYPE_LAND ) ~= 0 or
    FilteredCard():GetCardType():Test( CARD_TYPE_ARTIFACT ) ~= 0) and
   (filteredCard ~= Object())
    </FILTER>
    <CONTINUOUS_ACTION layer="7C">
    if FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       if characteristics ~= nil then
        characteristics:CardType_GetWritable(FilteredCard()):Add( CARD_TYPE_ENCHANTMENT, FilteredCard() )
       end
    end
    </CONTINUOUS_ACTION>
Any suggestions? Am I pushing the game beyond it's limits?

Re: Enchanted Evening (couple of bugs)

PostPosted: 22 Nov 2012, 19:49
by thefiremind
The layer for type changes isn't "7C" but "3". Try to change that first, but I don't think it will solve the problem. Kevlahnota had problems with Opalescence because enchantments with other types aren't officially supported, this is more or less the same thing.

About issue #1 you would just have to define the various COMPOUND_[...]_ENCHANTMENT in the TEXT_PERMANENT directory. You can find the already defined type sets inside CARD_UI_TEXT0000.XML in the core WAD. But it's useless if issue #2 can't be solved.

Re: Enchanted Evening (couple of bugs)

PostPosted: 22 Nov 2012, 21:26
by Vervandi
I've got a plan, but it is going to have to wait until after I eat some turkey. It's terribly inelegant:

I am going to modify the spell to only change lands and artifacts, which seems to work fine. Then, I am going to create a new creature type "Enchantment". Modify the spell to add that creature type to all creatures. Finally, any spell interactions with enchantments I will add an or statement to look for creatures with the type "Enchantment" in addition to actual enchantments. Only a few spells do this in the core game I think, so it shouldn't be too hard to hunt them down.

Re: Enchanted Evening (couple of bugs)

PostPosted: 23 Nov 2012, 00:03
by Vervandi
Hmm, struggling with adding a creature type to all creatures in play. Pretty sure I am missing something simple. Here is the code:

Code: Select all
   <STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
   <FILTER>
   local filteredCard = FilteredCard()
    return ((filteredCard ~= nil) and 
    (filteredCard:GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0) and
    (filteredCard:GetZone() ~= (ZONE_IN_PLAY)) and
    (filteredCard ~= Object()))
    </FILTER>
    <CONTINUOUS_ACTION layer="4">
    if FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       if characteristics ~= nil then
      characteristics:CardType_GetWritable(FilteredCard()):Add( CREATURE_TYPE_ENCHANTMENT, FilteredCard() )
       end
    end
  </CONTINUOUS_ACTION>
</STATIC_ABILITY>
Other information...

I've added a line in Creature_Types: "Enchantment"

I used Rise From the Dead as an example, since it adds zombie to the creature type.

Pretty sure I am missing something obvious here, any help is greatly appreciated!

Re: Enchanted Evening (couple of bugs)

PostPosted: 23 Nov 2012, 05:17
by Vervandi
Holy cow, what a mess this was. I didn't realize so much went into creating a new creature type.

Final working code:

Code: Select all
<STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
   <FILTER>
    local filteredCard = FilteredCard()
    return ((filteredCard ~= nil) and 
    (filteredCard:GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0) and
    (filteredCard:GetZone() == (ZONE_IN_PLAY)) and
    (filteredCard ~= Object()))
    </FILTER>
    <CONTINUOUS_ACTION layer="4">
    if FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       if characteristics ~= nil then
        characteristics:SubType_GetWritable(FilteredCard()):Add( CREATURE_TYPE_ENCHANTMENT , FilteredCard() )
       end
    end
Then I downloaded RiiakShiNal's functions related to creating creature constants, and the text file. I added a new type and then created an row in the XML. It works great. The next step is to alter spells that target enchantments to target enchantments and creatures of type enchantment.