[ian-reeds-games] Re: Some more questions

  • From: "Craig Brett" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "craigbrett17@xxxxxxx" for DMARC)
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Sat, 28 Feb 2015 11:59:54 +0000

Hmmm. I've got this in CB.js that removes any transforming effects on the beginning of each turn.


        if (effect.ScriptFlags.get("transform_into")) {
// its a transform effect. revert the unit and remove the effect from the old unit var oldUnit = revert_unit_type({ target: unit, effect: effect });
                if (oldUnit) {
// look through the reverted units effects for the one with the right IndexedName
                    // maybe this is a case for a helper method?
for (var index3 = 0; index3 < oldUnit.Effects.length; index3++) {
                        var oldEffect = oldUnit.Effects[index3];
                        if (oldEffect.IndexedName == effect.IndexedName) {
                            // its the right effect, remove it
                            oldUnit.Effects.Remove(oldEffect);
                        }
                    }
                }

say("{0} fizzles from {1}".format(effect.FriendlyName, unit.GetName()));
                var fizzleSound = effect.ScriptFlags.get("fizzle_sound");
                if (fizzleSound) {
                    sound(fizzleSound);
                }
var fizzleMessage = effect.ScriptFlags.get("fizzle_message");
                if (fizzleMessage) {
                    var msg = chooseFromARandomSelectString(fizzleMessage);
                    say(msg.format(unit.GetName()));
                }
            }

Any good?

On 28/02/2015 11:18, Carlos Macintosh wrote:
No, I don't think so. When you do transformations, effects don't transfer over, so you don't have to remove them.



Other related posts: