public override void UpdateState(T t, ExtractedParameters state) { var character = t as Character <T>; if (state.HasValue(nameof(HitPoints))) { character.HitPoints = state.ToValue <int>(nameof(HitPoints)); } if (state.HasValue(nameof(ArmourClass))) { character.ArmourClass = state.ToValue <int>(nameof(ArmourClass)); } base.UpdateState(t, state); }
public override void UpdateState(Wall wall, ExtractedParameters state) { if (state.HasValue(nameof(WallType))) { wall.WallType = state.ToValue <WallDirection>(nameof(WallType)); } base.UpdateState(wall, state); }
public override void UpdateState(Door door, ExtractedParameters state) { if (state.HasValue(nameof(DoorId))) { door.DoorId = state.ToValue <int>(nameof(DoorId)); } base.UpdateState(door, state); }
public override void UpdateState(MeleeWeapon weapon, ExtractedParameters state) { if (state.HasValue(nameof(WeaponName))) { weapon.WeaponName = state.ToString(nameof(WeaponName)); } if (state.HasValue(nameof(Owner))) { weapon.Owner = state.ToString(nameof(Owner)); } if (state.HasValue(nameof(Weight))) { weapon.Weight = state.ToValue <double>(nameof(Weight)); } if (state.HasValue(nameof(Level))) { weapon.Level = state.ToValue <int>(nameof(Level)); } if (state.HasValue(nameof(OriginalCost))) { weapon.OriginalCost = state.ToValue <double>(nameof(OriginalCost)); } if (state.HasValue(nameof(Dice))) { weapon.Dice = state.ToString(nameof(Dice)); (weapon.NumRolls, weapon.MaxPoints) = weapon.Dice.FromDice(); } else { if (state.HasValue(nameof(NumRolls))) { weapon.NumRolls = state.ToValue <int>(nameof(NumRolls)); } if (state.HasValue(nameof(MaxPoints))) { weapon.MaxPoints = state.ToValue <int>(nameof(MaxPoints)); } } if (state.HasValue(nameof(MagicBonuses))) { weapon.MagicBonuses = state.ToString(nameof(MagicBonuses)); (weapon.Hit, weapon.Damage) = MagicBonuses.FromBrackets(); } else { if (state.HasValue(nameof(Hit))) { weapon.Hit = state.ToValue <int>(nameof(Hit)); } if (state.HasValue(nameof(Damage))) { weapon.Damage = state.ToValue <int>(nameof(Damage)); } } base.UpdateState(weapon, state); }