public void Reset() { ActionFrom = string.Empty; ActionTo = string.Empty; ActionType = StatBlockInfo.ActionTypes.None; Targets = null; WeaponInfo = new WeaponInfo(); SpellInfo = null; }
public static string CastSpell(string SpellName, SpellStatBlock_Combat SpellData, List <IndividualStatBlock_Combat> Targets) { SpellName = SpellName.Replace(PathfinderConstants.SPACE, "_"); //IndividualStatBlock_Combat oTargetStatBlock = null; Assembly a = null; try { a = Assembly.Load("SpellEffects"); } catch (FileNotFoundException ex) { } Type spell = a.GetType("SpellEffects.CastSpell"); //null if not found object obj = Activator.CreateInstance(spell); MethodInfo mi = spell.GetMethod(SpellName); if (mi == null) { throw new Exception("Missing Spell Effect: " + SpellName); } ParameterInfo[] ParamInfos = mi.GetParameters(); object[] args = new object[ParamInfos.Count()]; int cnt = 0; foreach (ParameterInfo pi in ParamInfos) { switch (pi.Name) { case "CasterLevel": args[cnt] = SpellData.CasterLevel; break; case "target": args[cnt] = Targets[0]; break; case "targets": args[cnt] = Targets; break; } cnt++; } if (ParamInfos.Any()) { return((string)mi.Invoke(obj, args)); } else { return((string)mi.Invoke(obj, null)); } }
public string CastSpell(string SpellName, SpellStatBlock_Combat SpellData, List <IndividualStatBlock_Combat> Targets) { return(SpellReflectionWrapper.CastSpell(SpellName, SpellData, Targets)); }