public TriggeredAbility(JSONArray template) { if (!Enum.TryParse<TriggerType>(template.getString(0), out type)) throw new ArgumentException("Unknown trigger type " + template.getString(0)); if(template.Length > 2) sourceTest = TriggerItemTest.create(template, 1); if(template.Length > 3) targetTest = TriggerItemTest.create(template, 2); effect = Effect_Base.createSingle(template.getArray(template.Length - 1)); if (template.Length > 4) { isAttackTrigger = template.getBool(3); } }