void AddDice(int quantity, int sides, string label, double modifier, VantageKind vantage, int creatureId, string backColor = null, string fontColor = null, string playerName = null) { if (vantage != VantageKind.Normal && quantity == 1) { quantity = 2; } DiceDto diceDto = new DiceDto(); if (backColor != null) { diceDto.BackColor = backColor; } if (fontColor != null) { diceDto.FontColor = fontColor; } diceDto.Label = label; if (playerName == null) { playerName = label; } diceDto.PlayerName = playerName; diceDto.CreatureId = creatureId; diceDto.Quantity = quantity; diceDto.Sides = sides; diceDto.Modifier = modifier; diceDto.Vantage = vantage; DiceDtos.Add(diceDto); }
static void AddVantageDice(DiceRoll diceRoll) { VantageKind vantageKind = diceRoll.VantageKind; if (diceRoll.IsOnePlayer) { List <int> creatureIds = diceRoll.GetCreatureIds(); if (creatureIds != null && creatureIds.Count == 1) { diceRoll.VantageKind = vantageKind; foreach (PlayerRollOptions playerRollOptions in diceRoll.PlayerRollOptions) { if (playerRollOptions.PlayerID == creatureIds[0]) { vantageKind = playerRollOptions.VantageKind; BeforePlayerRolls(creatureIds[0], diceRoll, ref vantageKind); playerRollOptions.VantageKind = vantageKind; break; } } } } else { foreach (PlayerRollOptions playerRollOptions in diceRoll.PlayerRollOptions) { vantageKind = playerRollOptions.VantageKind; BeforePlayerRolls(playerRollOptions.PlayerID, diceRoll, ref vantageKind); } } }
static void BeforePlayerRolls(int playerId, DiceRoll diceRoll, ref VantageKind vantageKind) { Character player = Game.GetPlayerFromId(playerId); if (player == null) { return; } player.BeforePlayerRollsDice(diceRoll, ref vantageKind); }
public void AddSavingThrowFor(Ability savingThrowAbility, InGameCreature inGameCreature) { Monster creature = AllMonsters.GetByKind(inGameCreature.Kind); if (creature != null) { VantageKind vantage = creature.GetVantage(DiceRollType.SavingThrow, savingThrowAbility); double modifier = creature.GetSavingThrowModifier(savingThrowAbility); AddDice(1, 20, inGameCreature.Name, modifier, vantage, InGameCreature.GetUniversalIndex(inGameCreature.Index)); } }
public void ReadyRollVantage(int playerId, VantageKind vantage) { CreatureStats playerState = GetPlayerStats(playerId); playerState.ReadyToRollDice = true; if (playerState.DiceStack.Count == 0) { playerState.AddD20(); } playerState.Vantage = vantage; }
public DiceRoll(VantageKind kind = VantageKind.Normal, string damageDice = "") { DamageDice = damageDice; VantageKind = kind; ThrowPower = 1.0; MinCrit = 20; // Some feats allow for a 19 to crit. SuccessMessage = "Success!"; FailMessage = "Fail!"; CritFailMessage = "Critical Fail!"; CritSuccessMessage = "Critical Success!"; MinDamage = 0; }
public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null) { ExpectingArguments(args, 1); VantageKind vantageKind = Expressions.Get <VantageKind>(args[0], player, target, spell); if (player is Character characterPlayer) { player.AddVantageThisRoll(vantageKind); } return(null); }
public DiceRoll(DiceRollType diceRollType, VantageKind kind = VantageKind.Normal, string damageDice = "") { Type = diceRollType; DamageHealthExtraDice = damageDice; VantageKind = kind; ThrowPower = 1.0; MinCrit = 20; // Some feats allow for a 19 to crit. //SuccessMessage = "Success!"; //FailMessage = "Fail!"; //CritFailMessage = "Critical Fail!"; //CritSuccessMessage = "Critical Success!"; MinDamage = 0; CritFailMessage = ""; CritSuccessMessage = ""; SuccessMessage = ""; FailMessage = ""; SkillCheck = Skills.none; SavingThrow = Ability.none; SpellName = ""; }
public bool Matches(string message) { if (message == "SetVantage(Normal)") { vantageKind = VantageKind.Normal; } else if (message == "SetVantage(Advantage)") { vantageKind = VantageKind.Advantage; } else if (message == "SetVantage(Disadvantage)") { vantageKind = VantageKind.Disadvantage; } else { return(false); } return(true); }
public bool Matches(string message) { const string normalStart = "SetVantage(Normal,"; const string advantageStart = "SetVantage(Advantage,"; const string disadvantageStart = "SetVantage(Disadvantage,"; string remainingMessage; if (message.StartsWith(normalStart)) { vantageKind = VantageKind.Normal; remainingMessage = message.Substring(normalStart.Length); } else if (message.StartsWith(advantageStart)) { vantageKind = VantageKind.Advantage; remainingMessage = message.Substring(advantageStart.Length); } else if (message.StartsWith(disadvantageStart)) { vantageKind = VantageKind.Disadvantage; remainingMessage = message.Substring(disadvantageStart.Length); } else { return(false); } remainingMessage = remainingMessage.Trim(); if (remainingMessage.Length > 0) { playerInitial = remainingMessage[0].ToString(); } else { return(false); } return(true); }
protected virtual void OnSkillCheckRequested(Skills skill, VantageKind vantageKind) { SkillCheckEventArgs eventArgs = new SkillCheckEventArgs(SkillCheckRequestedEvent, skill, vantageKind); RaiseEvent(eventArgs); }
protected virtual void OnSavingThrowRequested(Ability ability, VantageKind vantageKind) { AbilityEventArgs eventArgs = new AbilityEventArgs(SavingThrowRequestedEvent, ability, vantageKind); RaiseEvent(eventArgs); }
public static string VantageToStr(VantageKind vantageKind) { return(Enum.GetName(typeof(VantageKind), vantageKind));; }
public PlayerRollOptions(int playerId, VantageKind vantageKind, string inspiration) { PlayerID = playerId; VantageKind = vantageKind; Inspiration = inspiration; }
public SkillCheckEventArgs(RoutedEvent routedEvent, Skills skill, VantageKind vantageKind) : base(routedEvent) { VantageKind = vantageKind; Skill = skill; }
public void AddPlayer(int playerId, VantageKind vantageKind, string inspiration) { PlayerRollOptions.Add(new PlayerRollOptions(playerId, vantageKind, inspiration)); }
public AbilityEventArgs(RoutedEvent routedEvent, Ability ability, VantageKind vantageKind) : base(routedEvent) { VantageKind = vantageKind; Ability = ability; }