package ChannelAbilityPreset import public AbilityObjEditing import OrderStringFactory import BitSet OrderStringFactory odf = new OrderStringFactory() @compiletime function initOdf() odf = new OrderStringFactory() public enum Option VISIBLE TARGETIMAGE PHYSICALSPELL UNIVERSALSPELL UNIQUECAST public enum Targettype NOTARGET UTARGET PTARGET PUTARGET PASSIVE public function Targettype.toString() returns string switch this case NOTARGET return "Instant Cast" case Targettype.PTARGET return "Point Target" case Targettype.UTARGET return "Unit Target" case Targettype.PUTARGET return "Point & Unit Target" case PASSIVE return "Passive" return "" public class ChannelAbilityPreset extends AbilityDefinitionIllidanChannel private bitset optionSet = bitset(0) construct(int newId, int lvls, boolean removeChannelProperties) super(newId) this.lvls = lvls setLevels(lvls) let orderString = odf.getOrderString(true) presetBaseOrderID((int _lvl) -> orderString) if removeChannelProperties removeChannelProperties(true) function removeChannelProperties(boolean removeVisuals) removeChannelProperties(removeVisuals, true) function removeChannelProperties(boolean removeVisuals, boolean makeVisible) presetDisableOtherAbilities((int lvl) -> false) presetFollowThroughTime((int lvl) -> 0.) presetArtDuration((int lvl) -> 0.) if makeVisible presetOption(Option.VISIBLE, true) if removeVisuals setArtCaster("") setArtEffect("") setArtSpecial("") setArtTarget("") function presetTargetTypes(Targettype ttype) presetTargetType((int lvl) -> ttype castTo int) function presetOption(Option opt, boolean flag) let pow = opt castTo int if optionSet.contains(pow) if not flag optionSet = optionSet.remove(pow) else if flag optionSet = optionSet.add(pow) presetOptions((int lvl) -> optionSet.val) function hasOption(Option option) returns boolean return optionSet.contains(option castTo int)