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 void SetReadyRollDice(int playerId, bool newValue, DieRollDetails dieRollDetails) { CreatureStats playerState = GetPlayerStats(playerId); playerState.ReadyToRollDice = newValue; playerState.ClearDiceStack(); foreach (Roll roll in dieRollDetails.Rolls) { playerState.AddRoll(roll); } }
public static void ApplyToCreature(Creature targetCreature, string spellId, Conditions conditions) { targetCreature.AddSpellCondition(spellId, conditions); if (targetCreature is Character player) { CreatureStats playerStats = PlayerStatManager.GetPlayerStats(player.playerID); if (playerStats != null) { playerStats.Conditions = player.AllConditions; } } }
public void ToggleCondition(int playerId, Conditions conditions) { CreatureStats playerStats = GetPlayerStats(playerId); if (playerStats.Conditions.HasFlag(conditions)) // Bit is set. { playerStats.Conditions &= ~conditions; // clear the bit } else { playerStats.Conditions |= conditions; } }
public CreatureStats GetPlayerStats(int creatureId) { CreatureStats foundPlayer = Players.FirstOrDefault(x => x.CreatureId == creatureId); if (foundPlayer != null) { return(foundPlayer); } CreatureStats playerState = new CreatureStats(creatureId); Players.Add(playerState); return(playerState); }
public void ToggleReadyRollD20(int playerId) { CreatureStats playerStats = GetPlayerStats(playerId); playerStats.DiceStack.Clear(); playerStats.AddD20(); if (playerStats.Vantage == VantageKind.Normal || !playerStats.ReadyToRollDice) { playerStats.ReadyToRollDice = !playerStats.ReadyToRollDice; } else { playerStats.Vantage = VantageKind.Normal; } }
public void ClearConditions(int playerId) { CreatureStats playerStats = GetPlayerStats(playerId); playerStats.Conditions = Conditions.None; }
public void ToggleTarget(int playerId) { CreatureStats playerStats = GetPlayerStats(playerId); playerStats.IsTargeted = !playerStats.IsTargeted; }