WrenchInthePlan Posted January 29, 2021 Share Posted January 29, 2021 I've been trying to create a Warping card for the mod I'm working on, but I haven't figured out how to actually get the warping effect to work. My code for the full card is below. Much of it has been copied and pasted from the code for the Warp Vial. Currently, the card can be used, but it has no effect listed, it can only target an enemy, and it doesn't have any effects when played. Anyone know what I'm doing wrong? Spoiler lyra_skill = { name = "Skill", anim = "taunt", flavour = "'You can't get very far without it, especially in my line of work.'", desc = "{WARPING}.{1}", desc_fn = function( self, fmt_str ) if self.bonus_desc then return loc.format( fmt_str, self.bonus_desc) else return loc.format( fmt_str, "" ) end end, loc_strings = { POWER_GAIN = "\nGain 1 {POWER}.", DRAW = "\nDraw 3 cards.", CARRY_OVER = "\nGain 2 Actions next turn.", REPLACE_CARDS = "\nDraw 2 cards, Discard 2 cards.", GUARD = "\nGain 5 {DEFENSE}.", }, rarity = CARD_RARITY.BASIC, cost = 0, flags = CARD_FLAGS.SKILL | CARD_FLAGS.EXPEND | CARD_FLAGS.STICKY, effects = { power_gain = { desc = "POWER_GAIN", anim = "taunt", target_type = TARGET_TYPE.SELF, target_mod = TARGET_MOD.SINGLE, flags = CARD_FLAGS.SKILL | CARD_FLAGS.EXPEND | CARD_FLAGS.STICKY, effect = function( self, battle, attack ) self.owner:AddCondition("POWER", 1, self) end, min_damage = nil, max_damage = nil, }, draw = { desc = "DRAW", anim = "taunt", target_type = TARGET_TYPE.SELF, target_mod = TARGET_MOD.SINGLE, discard_amount = 2, draw_count = 2, flags = CARD_FLAGS.SKILL | CARD_FLAGS.EXPEND | CARD_FLAGS.STICKY, effect = function( self, battle, attack ) battle:DrawCards(self.draw_count) battle:DiscardCards(self.discard_amount) end, min_damage = nil, max_damage = nil, }, replace_cards = { desc = "REPLACE_CARDS", anim = "taunt", target_type = TARGET_TYPE.SELF, target_mod = TARGET_MOD.SINGLE, draw_count = 3, flags = CARD_FLAGS.SKILL | CARD_FLAGS.EXPEND | CARD_FLAGS.STICKY, effect = function( self, battle, attack ) battle:DrawCards(self.draw_count) end, min_damage = nil, max_damage = nil, }, guard = { desc = "GUARD", anim = "taunt", target_type = TARGET_TYPE.SELF, target_mod = TARGET_MOD.SINGLE, defend_amount = 3, effect = function( self, battle, attack ) attack:AddCondition( "DEFEND", self.defend_amount, self ) end, min_damage = nil, max_damage = nil, }, ChangeEffect = function( self, effect_id ) self:NotifyTriggered() local effect_table = self.effects[effect_id] self.bonus_desc = self.def:GetLocalizedString( effect_table.desc ) self.anim = effect_table.anim self.target_type = effect_table.target_type self.target_mod = effect_table.target_mod if CheckBits(self.flags, CARD_FLAGS.FREEBIE) then self.flags = effect_table.flags | CARD_FLAGS.FREEBIE else self.flags = effect_table.flags end self.OnPostResolve = effect_table.effect self.min_damage = effect_table.min_damage self.max_damage = effect_table.max_damage end, event_priorities = { [ BATTLE_EVENT.BEGIN_PLAYER_TURN ] = 9, }, deck_handlers = { DECK_TYPE.DRAW, DECK_TYPE.DISCARDS, DECK_TYPE.IN_HAND }, event_handlers = { [ BATTLE_EVENT.BEGIN_PLAYER_TURN ] = function( self, battle ) local available_effects = {} for id,effect in pairs(self.effects) do if self.current_effect == nil or self.current_effect ~= id then table.insert(available_effects, id) end end self:ChangeEffect(available_effects[math.random(#available_effects)]) end, } }, Link to comment Share on other sites More sharing options...
Developer rooks Posted January 30, 2021 Developer Share Posted January 30, 2021 In the snippet you posted, there's a missing } brace closing the 'effects' table. If I fix the syntax, the card does seems to work just fine. Link to comment Share on other sites More sharing options...
WrenchInthePlan Posted January 30, 2021 Author Share Posted January 30, 2021 Oh. Well, that's... embarrassing. Thanks for catching that. Link to comment Share on other sites More sharing options...
Developer rooks Posted January 30, 2021 Developer Share Posted January 30, 2021 No problemo, happens all the time. Did you notice a callstack during launch? Link to comment Share on other sites More sharing options...
WrenchInthePlan Posted January 31, 2021 Author Share Posted January 31, 2021 I'm afraid I don't know what you mean by "callstack" (I don't have very much knowledge of lua in general - I've mostly been copying code from the game itself and modifying it as needed to make the cards I want). The game simply loaded and took me to the title screen, both before and after I fixed the issue with the 'effects' table. Link to comment Share on other sites More sharing options...
RageLeague Posted January 31, 2021 Share Posted January 31, 2021 I'm assuming the callstack is the warning that shows up during the loading of your mode if any error occurs, whether it's a syntax error, name error, or type error, or some other errors. A blatant syntax error like this should show up as a warning. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.