Magic Affinities in Remixed Dungeon determine which spells are available to a character class or hero subclass. Each class typically has a primary affinity which grants access to specific spells.
The magic affinity system is implemented in several Java files:
// In SpellHelper.java public static final String AFFINITY_NECROMANCY = "Necromancy"; public static final String AFFINITY_ELEMENTAL = "Elemental"; public static final String AFFINITY_RAGE = "Rage"; public static final String AFFINITY_DEMONOLOGY = "Demolonogy"; public static final String AFFINITY_NATURE = "Nature"; public static final String AFFINITY_SHADOW = "Shadow"; public static final String AFFINITY_COMMON = "Common"; // In HeroClass.java private String magicAffinity = Utils.EMPTY_STRING; // In SpellFactory.java static private Map<String,ArrayList<String>> mSpellsByAffinity;
SpellHelper.AFFINITY_COMMONAbilities_Common → “Common Spells”Abilities_Default → “Mastery”SpellHelper.AFFINITY_ELEMENTALAbilities_Elemental → “Elemental Spells”SpellHelper.AFFINITY_NECROMANCYAbilities_Necromancy → “Necromancy”Abilities_Default → “Mastery”Abilities_Default → “Mastery”Abilities_Default → “Mastery”Abilities_Default → “Mastery”Abilities_Default → “Mastery”Abilities_Default → “Mastery”SpellHelper.AFFINITY_RAGEAbilities_Default → “Mastery”SpellHelper.AFFINITY_NATUREAbilities_Default → “Mastery”SpellHelper.AFFINITY_SHADOWAbilities_Default → “Mastery”SpellHelper.AFFINITY_DEMONOLOGYAbilities_Default → “Mastery”
The affinity system is implemented using Lua scripts in scripts/spells/SpellsByAffinity.lua and scripts/spells/CustomSpellsList.lua:
-- In CustomSpellsList.lua local spells = {} spells["Necromancy"] = {"RaiseDead","Exhumation", "DarkSacrifice","Possess"} spells["Common"] = {"TownPortal","Heal","RaiseDead","Cloak","Calm","Charm"} spells["Combat"] = {"DieHard","Dash","BodyArmor","Smash"} spells["Rogue"] = {"Cloak","Backstab","KunaiThrow","Haste"} spells["Witchcraft"] = {"Roar","LightningBolt","Heal","Order"} spells["Huntress"] = {"Calm","Charm","ShootInEye","SummonBeast"} spells["Elf"] = {"MagicArrow","Sprout","HideInGrass","NatureArmor"} spells["Priest"] = {"Heal","Calm","Charm","Order"} spells["PlagueDoctor"] = {"Heal","Calm","Charm","Order"} spells["Dev"] = {"TestSpell", "CurseItem"} return spells
The hero class determines the magic affinity:
// In Hero.java public boolean hasMagicAffinity() { return !heroClass.getMagicAffinity().isEmpty(); } // In HeroClass.java private String magicAffinity = Utils.EMPTY_STRING;
Abilities_Default: “Mastery”Abilities_Common: “Common Spells”Abilities_Elemental: “Elemental Spells”Abilities_Necromancy: “Necromancy”