public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null) { CreaturePlusModId recipient = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables); if (recipient == null) { throw new Exception($"CreaturePlusModId recipient must be specified before evaluating expressions containing AddPropertyMod."); } ExpectingArguments(args, 2, 3); string propertyName = string.Empty; if (args[0] is string) { propertyName = args[0]; } double offset = Expressions.GetDouble(args[1], player, target, spell); double multiplier = 1; if (args.Count == 3) { multiplier = Expressions.GetDouble(args[2], player, target, spell); } recipient.Creature.AddPropertyMod(propertyName, recipient.ID, offset, multiplier); return(null); }
/// <summary> /// Triggers the specified event, ensuring a CreaturePlusModId is passed in as custom data to the expressions engine. /// </summary> void TriggerEvent(Creature magicOwner, string eventCode) { if (string.IsNullOrWhiteSpace(eventCode)) { return; } SystemVariables.Creature = magicOwner; CreaturePlusModId creaturePlusModId = new CreaturePlusModId(GetModId(), magicOwner, Id); creaturePlusModId.Magic = this; List <string> args = GetArgumentList(); //if (MagicItem != null) //{ // SystemVariables.CardId = GetParameter<string>("CardId"); // SystemVariables.CardGuid = GetParameter<string>("CardGuid"); // SystemVariables.CardUserName = GetParameter<string>("UserName"); //} //if (Args.Length > 0 && Args[0] is IGetUserName iGetUserName) // It's a Card. //{ // SystemVariables.ThisCard = iGetUserName; //} string expressionToEvaluate = DndUtils.InjectParameters(eventCode, MagicItem.Parameters, args); Expressions.Do(expressionToEvaluate, magicOwner, null, null, null, creaturePlusModId); }
public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null) { ExpectingArguments(args, 0); CreaturePlusModId recipient = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables); OnRequestCardReveal(new CreaturePlusModIdEventArgs(recipient)); return(null); }
public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null) { ExpectingArguments(args, 1, 6); string spellId = null; if (spell != null) { spellId = spell.ID; } else { CreaturePlusModId creaturePlusModId = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables); if (creaturePlusModId != null) { spellId = creaturePlusModId.Guid; } } float lifeTime = 0; float shrinkTime = 0; float rotationDegrees = 0; if (player != null && spellId != null) { string effectName = Expressions.GetStr(args[0]); float secondsDelayStart = 0; float enlargeTime = 0; if (args.Count > 1) { float.TryParse(args[1], out secondsDelayStart); if (args.Count > 2) { float.TryParse(args[2], out enlargeTime); if (args.Count > 3) { float.TryParse(args[3], out lifeTime); if (args.Count > 4) { float.TryParse(args[4], out shrinkTime); if (args.Count > 5) { float.TryParse(args[5], out rotationDegrees); } } } } } OnAttachChargingEffect(effectName, spellId, player.taleSpireId, secondsDelayStart, enlargeTime, lifeTime, shrinkTime, rotationDegrees); } return(null); }
/// <summary> /// Triggers the specified event, ensuring a CreaturePlusModId is passed in as custom data to the expressions engine. /// </summary> void TriggerEvent(Creature magicOwner, string eventCode) { if (string.IsNullOrWhiteSpace(eventCode)) { return; } CreaturePlusModId creaturePlusModId = new CreaturePlusModId(GetModId(), magicOwner); List <string> args = GetArgumentList(); string expressionToEvaluate = DndUtils.InjectParameters(eventCode, MagicItem.Parameters, args); Expressions.Do(expressionToEvaluate, magicOwner, null, null, null, creaturePlusModId); }
public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null) { CreaturePlusModId recipient = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables); if (recipient == null) { throw new Exception($"CreaturePlusModId recipient must be specified before evaluating expressions containing RemovePropertyMod."); } ExpectingArguments(args, 0); recipient.Creature.RemoveVantageMod(recipient.ID); return(null); }
public static string GetSpellId(this ExpressionEvaluator evaluator, CastedSpell spell) { string spellId = null; if (spell != null) { spellId = spell.ID; } else { CreaturePlusModId creaturePlusModId = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables); if (creaturePlusModId != null) { spellId = creaturePlusModId.Guid; } } return(spellId); }
public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target = null, CastedSpell spell = null, DiceStoppedRollingData dice = null) { ExpectingArguments(args, 1, 4); string fillColor = "player"; string outlineColor = "player"; int delayMs = 0; if (args.Count > 1) { fillColor = args[1].Trim(); if (args.Count > 2) { outlineColor = args[2].Trim(); if (args.Count > 3) { delayMs = Expressions.GetInt(args[3], player, target, spell, dice); } } } CreaturePlusModId recipient = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables); if (recipient != null && recipient.Creature is Character recipientPlayer) { recipientPlayer.ShowState(Expressions.GetStr(args[0], player, target, spell), fillColor, outlineColor, delayMs); } else if (player != null) { player.ShowState(Expressions.GetStr(args[0], player, target, spell), fillColor, outlineColor, delayMs); } else if (recipient.Creature != null) { recipient.Creature.ShowState(Expressions.GetStr(args[0], player, target, spell), fillColor, outlineColor, delayMs); // TODO: Implement FloatCreatureText //FloatCreatureText(recipient.Creature, args[0]); } return(null); }
public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Character player, Target target, CastedSpell spell, DiceStoppedRollingData dice = null) { CreaturePlusModId recipient = Expressions.GetCustomData <CreaturePlusModId>(evaluator.Variables); if (recipient == null) { throw new Exception($"CreaturePlusModId recipient must be specified before evaluating expressions containing AddPropertyMod."); } ExpectingArguments(args, 4); DiceRollType rollType = Expressions.Get <DiceRollType>(args[0], player, target, spell); Skills skills = Expressions.Get <Skills>(args[1].Trim(), player, target, spell); string dieLabel = args[2].Trim(); if (dieLabel.StartsWith("\"")) { dieLabel = Expressions.GetStr(dieLabel, player, target, spell); } int vantageOffset = Expressions.GetInt(args[3], player, target, spell); recipient.Creature.AddVantageMod(recipient.ID, rollType, skills, dieLabel, vantageOffset); return(null); }
public DispelMagicEventArgs(CreaturePlusModId recipient) { Recipient = recipient; }
public CreaturePlusModIdEventArgs(CreaturePlusModId creaturePlusModId) { CreaturePlusModId = creaturePlusModId; }