public void UpdateDictionaries() { foreach (Monster mon in Monsters.Values) { foreach (HarvestingTableRow htRow in mon.HarvestingTable.Rows) { if (!string.IsNullOrEmpty(htRow.ItemNameRef) && HarvestedItems.TryGetValue(htRow.ItemNameRef.ToLower(), out HarvestedItem hItem)) { htRow.Item = hItem; } } if (!string.IsNullOrEmpty(mon.CreatureTypeRef) && CreatureTypes.TryGetValue(mon.CreatureTypeRef.ToLower(), out CreatureType cType)) { mon.CreatureType = cType; } if (!string.IsNullOrEmpty(mon.TrinketTableType) && TrinketTables.TryGetValue(mon.TrinketTableType.ToLower(), out TrinketTable tTable)) { mon.TrinketTable = tTable; } } StorageStateChanged?.Invoke(); }
public Hero(CreatureTypes creatureType, int health, int maxHealth, int id) { CreatureType = creatureType; Health = health; MaxHealth = maxHealth; ID = id; }
public void AppendState(DnDToolsState otherState) { Monsters.AddRange(otherState.Monsters); CreatureTypes.AddRange(otherState.CreatureTypes); HarvestedItems.AddRange(otherState.HarvestedItems); TrinketTables.AddRange(otherState.TrinketTables); }
private string GetRaceStringForTimeStamp(int year, int month, int day) { if (!CreatureTypes.Any()) { return(RaceString); } List <CreatureType> relevantCreatureTypes = GetRelevantCreatureTypesByTimeStamp(year, month, day); string raceString = ""; if (!string.IsNullOrWhiteSpace(PreviousRace)) { raceString += PreviousRace.ToLower(); } else if (!string.IsNullOrWhiteSpace(AnimatedType)) { raceString += AnimatedType.ToLower(); } else { raceString += Race.NameSingular.ToLower(); } foreach (var creatureType in relevantCreatureTypes) { raceString += " " + creatureType.Type; } return(raceString); }
public virtual void Reset() { ResetSkills(); m_AnimationDelta = UnityEngine.Vector3Int.zero; m_AnimationDirection = Directions.North; m_AnimationEnd = 0; m_AnimationSpeed = UnityEngine.Vector3Int.zero; m_Brightness = 0; m_Direction = Directions.North; m_ID = 0; m_Trapper = false; m_Unpassable = false; m_KnownSince = -1; m_LightColor = UnityEngine.Color.black; m_MovementEnd = 0; m_MovementRunning = false; Name = null; m_PartyFlag = PartyFlags.None; m_PKFlag = PKFlags.Revenge; m_Type = CreatureTypes.Monster; m_Visible = false; m_GuildFlag = GuildFlags.None; m_Marks.Clear(); m_MountOutfit = null; m_Outfit = null; m_Position = UnityEngine.Vector3Int.zero; }
public ICreature GenerateCreature(CreatureTypes creatureType) { int startingHealth = creatureTypeAndStartingHealth[creatureType]; int startingGold = creatureTypeAndStartingGold[creatureType]; ICreature creature; switch (creatureType) { case CreatureTypes.Human: Hero hero = new Hero(creatureType, startingHealth, startingHealth, GetNextCreatureID()); hero.Inventory.AddGold(startingGold); creature = hero; break; case CreatureTypes.Goblin: case CreatureTypes.Troll: Monster monster = new Monster(creatureType, startingHealth, startingHealth, GetNextCreatureID()); monster.Inventory.AddGold(startingGold); creature = monster; break; default: return(null); } return(creature); }
private void TryStore5eMonster(Monster5e monster5e) { // ignore NPCs for now if (monster5e.IsNPC || monster5e.HasCopyDirective) { return; } try { Monster monster = null; CreatureType creatureType = null; monster = monster5e.ConvertToUsable(); creatureType = monster5e.CreatureType.ConvertToUsable(); CreatureTypes.TryAdd(creatureType.ToString().ToLower(), creatureType); if (Monsters.TryGetValue(monster.Name.ToLower(), out Monster storedMonster)) { storedMonster.CopyInMissing(monster); } else { Monsters.TryAdd(monster.Name.ToLower(), monster); } UpdateDictionaries(); } catch (Exception) { throw new Exception($"Damn it!! {monster5e.Name}"); } }
public CreateActorWindowViewModel() { _feats = new List <string>(); _specialQualities = new List <string>(); _attackSets = new FullyObservableCollection <Model.AttackSet>(); _speeds = new Model.SpeedSet(); _immunities = new Model.DamageDescriptorSet(); _weapons = new ObservableCollection <Model.Weapon>(); _damageReductions = new ObservableCollection <Model.DamageReduction>(); _energyResistances = new ObservableCollection <Model.EnergyResistance>(); _addSpeed = new Command(ExecuteAddSpeed); _editSpeed = new Command(ExecuteEditSpeed); _removeSpeed = new Command(ExecuteRemoveSpeed); _addAttackSet = new Command(ExecuteAddAttackSet); _editAttackSet = new Command(ExecuteEditAttackSet); _removeAttackSet = new Command(ExecuteRemoveAttackSet); _addWeapon = new Command(ExecuteAddWeapon); _editWeapon = new Command(ExecuteEditWeapon); _removeWeapon = new Command(ExecuteRemoveWeapon); _addDamageReduction = new Command(ExecuteAddDamageReduction); _editDamageReduction = new Command(ExecuteEditDamageReduction); _removeDamageReduction = new Command(ExecuteRemoveDamageReduction); _addEnergyResistance = new Command(ExecuteAddEnergyResistance); _editEnergyResistance = new Command(ExecuteEditEnergyResistance); _removeEnergyResistance = new Command(ExecuteRemoveEnergyResistance); _editImmunities = new Command(ExecuteEditImmunities); _openImportWindow = new Command(ExecuteOpenImportWindow); SelectedCreatureType = CreatureTypes.IndexOf(Methods.GetCreatureTypeString(Types.Creature.Humanoid)); SelectedSize = Sizes.IndexOf(Methods.GetSizeString(Types.Size.Medium)); }
private void AssertCreatureIsCorrect(ICreature creature, CreatureTypes creatureType) { Assert.AreEqual(creatureType, creature.CreatureType); Assert.AreEqual(StartingCreatureLevel, creature.Level); Assert.AreEqual(StartingCreatureExperience, creature.Experience); Assert.IsTrue(creature.Health > 0); Assert.AreEqual(creature.Health, creature.MaxHealth); }
public Creature(uint id, CreatureTypes type = CreatureTypes.Monster, string name = null) { m_ID = id; m_Type = type; m_Name = name; m_Marks.onMarksChange.AddListener((marks) => { onMarksChange.Invoke(this, marks); }); ResetSkills(); }
public void GenerateCreatureTest_GenerateGoblin() { const int StartingGold = 5; const CreatureTypes TypeCreature = CreatureTypes.Goblin; ICreature creature = GetCreature(TypeCreature); AssertCreatureIsCorrect(creature, TypeCreature); AssertMonsterIsCorrect(creature, StartingGold); }
public void GenerateCreatureTest_GenerateTroll() { const int StartingGold = 20; const CreatureTypes TypeCreature = CreatureTypes.Troll; ICreature creature = GetCreature(TypeCreature); AssertCreatureIsCorrect(creature, TypeCreature); AssertMonsterIsCorrect(creature, StartingGold); }
//determine if whale public Boolean IsWhaleOrNot(CreatureTypes type) { if (type.Equals(CreatureTypes.BottleNose)) { return(true); } else if (type.Equals(CreatureTypes.MoonJelly)) { return(false); } return(false); //make compiler happy }
public void UpdateCreatures() { foreach (Creature reproducingCreature in Creatures.FindAll(creature => creature.NextStatus == LifeStatus.Reproduce)) { ICreatureType newbornCreatureType = CreatureTypes.Mutate(reproducingCreature.CreatureType, reproducingCreature.Id); AddCreature(newbornCreatureType); } Log.Information(""); foreach (Creature dyingCreature in Creatures.FindAll(creature => creature.NextStatus == LifeStatus.Die)) { RemoveCreature(dyingCreature); } }
public void GenerateCreatureTest_GenerateHuman() { const int StartingGold = 10; const CreatureTypes TypeCreature = CreatureTypes.Human; ICreature creature = GetCreature(TypeCreature); AssertCreatureIsCorrect(creature, TypeCreature); Assert.IsTrue(creature is IHero); if (creature is IHero hero) { Assert.IsNotNull(hero.Inventory); Assert.AreEqual(StartingGold, hero.Inventory.Gold); } }
public static ICreature GetCreatureByNameAndInitParams(CreatureTypes type, MobileObjectInitialization init) { switch (type) { case CreatureTypes.Player: return(init.IsDefaultInitialization ? new Player(new MobileObjectInitialization(init.Position, init.Direction)) : new Player(init)); case CreatureTypes.Guard: return(init.IsDefaultInitialization ? new Guard(new MobileObjectInitialization(init.Position, init.Direction)) : new Guard(init)); default: throw new Exception("Попытка создания несуществующего Creature: " + type); } }
//create hat private GameObject CreateHat(GameObject parent, String hatType, CreatureTypes localType) { //create weapon GameObject hat = new GameObject("Hat"); hat.transform.SetParent(parent.transform); Vector3 attachPoint = Vector3.zero; Vector3 scalePoint = Vector3.zero; if (localType.Equals(CreatureTypes.MoonJelly)) { attachPoint = CustomizationHandler.moonjellyfishHatPoint; scalePoint = CustomizationHandler.moonjellyfishHatScale; } if (localType.Equals(CreatureTypes.BottleNose)) { attachPoint = CustomizationHandler.bottlenoseHatPoint; scalePoint = CustomizationHandler.bottlenoseHatScale; } if (IsWhaleOrNot(localType)) { attachPoint /= 40; scalePoint /= 55; hat.transform.rotation = Quaternion.Euler(0, 0, -90); } else { attachPoint /= 275; scalePoint /= 200; } hat.transform.localPosition = attachPoint; hat.transform.localScale = scalePoint; SpriteRenderer hatRenderer = hat.AddComponent <SpriteRenderer>(); hatRenderer.sprite = hatSpritesMap[hatType]; hatRenderer.sortingOrder = -2; return(hat); }
//create glasses private GameObject CreateGlasses(GameObject parent, String glassesType, CreatureTypes localType) { //create weapon GameObject glasses = new GameObject("Glasses"); glasses.transform.SetParent(parent.transform); Vector3 attachPoint = Vector3.zero; Vector3 scalePoint = Vector3.zero; if (localType.Equals(CreatureTypes.MoonJelly)) { attachPoint = CustomizationHandler.moonjellyfishEyePoint; scalePoint = CustomizationHandler.moonjellyfishEyeScale; } if (localType.Equals(CreatureTypes.BottleNose)) { attachPoint = CustomizationHandler.bottlenoseEyePoint; scalePoint = CustomizationHandler.bottlenoseEyeScale; } if (IsWhaleOrNot(localType)) { attachPoint /= 40; scalePoint /= 50; glasses.transform.rotation = Quaternion.Euler(0, 0, -90); } else { attachPoint /= 325; scalePoint /= 200; } glasses.transform.localPosition = attachPoint; glasses.transform.localScale = scalePoint; SpriteRenderer hatRenderer = glasses.AddComponent <SpriteRenderer>(); hatRenderer.sprite = eyepieceSpritesMap[glassesType]; hatRenderer.sortingOrder = -3; return(glasses); }
//create mouthpiece private GameObject CreateMouthpiece(GameObject parent, String mouthpieceType, CreatureTypes localType) { //create weapon GameObject mouthpiece = new GameObject("Mouthpiece"); mouthpiece.transform.SetParent(parent.transform); Vector3 attachPoint = Vector3.zero; Vector3 scalePoint = Vector3.zero; if (localType.Equals(CreatureTypes.MoonJelly)) { attachPoint = CustomizationHandler.moonjellyfishMouthPoint; scalePoint = CustomizationHandler.moonjellyfishMouthScale; } if (localType.Equals(CreatureTypes.BottleNose)) { attachPoint = CustomizationHandler.bottlenoseMouthPoint; scalePoint = CustomizationHandler.bottlenoseMouthScale; } if (IsWhaleOrNot(localType)) { attachPoint /= 38; scalePoint /= 55; mouthpiece.transform.rotation = Quaternion.Euler(0, 0, -90); } else { attachPoint /= 450; scalePoint /= 200; } mouthpiece.transform.localPosition = attachPoint; mouthpiece.transform.localScale = scalePoint; SpriteRenderer hatRenderer = mouthpiece.AddComponent <SpriteRenderer>(); hatRenderer.sprite = mouthpieceSpritesMap[mouthpieceType]; hatRenderer.sortingOrder = -2; return(mouthpiece); }
public void AddCreatureType(string type) { if (CreatureTypes.Count == 0) { CreatureTypes.Add(type); return; } else { foreach (string creatureType in CreatureTypes) { if (creatureType == type) { return; } } CreatureTypes.Add(type); return; } }
//create vest private GameObject CreateVest(GameObject parent, String vestType, CreatureTypes localType) { //create weapon GameObject vest = new GameObject("Vest"); vest.transform.SetParent(parent.transform); Vector3 attachPoint = Vector3.zero; Vector3 scalePoint = Vector3.zero; if (localType.Equals(CreatureTypes.MoonJelly)) { attachPoint = CustomizationHandler.moonjellyfishVestPoint; scalePoint = CustomizationHandler.moonjellyfishVestScale; } if (localType.Equals(CreatureTypes.BottleNose)) { attachPoint = CustomizationHandler.bottlenoseVestPoint; scalePoint = CustomizationHandler.bottlenoseVestScale; } if (IsWhaleOrNot(localType)) { attachPoint /= 250; scalePoint /= 50; } else { attachPoint /= 275; scalePoint /= 200; } vest.transform.localPosition = attachPoint; vest.transform.localScale = scalePoint; SpriteRenderer hatRenderer = vest.AddComponent <SpriteRenderer>(); hatRenderer.sprite = vestSpritesMap[vestType]; hatRenderer.sortingOrder = -4; return(vest); }
private ITile[] GetValidCreatureTypes(IMap map, CreatureTypes creatureType) { switch (creatureType) { case CreatureTypes.Human: return(map.Tiles.Where(x => x.TileValue == TileValues.Village || x.TileValue == TileValues.City || x.TileValue == TileValues.Fortress) .ToArray()); case CreatureTypes.Goblin: case CreatureTypes.Troll: return(map.Tiles.Where(x => x.TileValue == TileValues.Grassland || x.TileValue == TileValues.Forest) .ToArray()); default: return(null); } }
public void LoadState(DnDToolsState initialState) { if (State == null) { State = initialState; } else { State.AppendState(initialState); } State.HarvestedItems.ForEach(hItem => HarvestedItems.TryAdd(hItem.Name.ToLower(), hItem)); State.CreatureTypes.ForEach(cType => CreatureTypes.TryAdd(cType.ToString().ToLower(), cType)); State.TrinketTables.ForEach(tTable => TrinketTables.TryAdd(tTable.TrinketTableType.ToLower(), tTable)); State.Monsters.ForEach(mon => Monsters.TryAdd(mon.Name.ToLower(), mon)); UpdateDictionaries(); IsLoaded = true; StorageStateChanged?.Invoke(); }
public void LoadCreature(Model.Creature creature) { ActorName = creature.ActorName; InitiativeMod = Methods.GetSignedNumberString(creature.InitiativeMod); SelectedCreatureType = CreatureTypes.IndexOf(Methods.GetCreatureTypeString(creature.Type)); ChallengeRating = creature.ChallengeRating.ToString(); AttackSets = creature.AttackSets; Strength = creature.Strength.ToString(); Dexterity = creature.Dexterity.ToString(); Constitution = creature.Constitution.ToString(); Intelligence = creature.Intelligence.ToString(); Wisdom = creature.Wisdom.ToString(); Charisma = creature.Charisma.ToString(); BaseAttackBonus = Methods.GetSignedNumberString(creature.BaseAttackBonus); GrappleModifier = Methods.GetSignedNumberString(creature.GrappleModifier); HitPoints = creature.HitPoints.ToString(); HitDice = creature.HitDice.ToString(); SelectedHitDie = DieTypes.IndexOf(Methods.GetDieTypeString(creature.HitDieType)); ArmorClass = creature.ArmorClass.ToString(); TouchArmorClass = creature.TouchArmorClass.ToString(); FlatFootedArmorClass = creature.FlatFootedArmorClass.ToString(); Speeds = creature.Speed; Space = creature.Space.ToString(); Reach = creature.Reach.ToString(); FortitudeSave = Methods.GetSignedNumberString(creature.FortitudeSave); ReflexSave = Methods.GetSignedNumberString(creature.ReflexSave); WillSave = Methods.GetSignedNumberString(creature.WillSave); Feats = creature.Feats; SelectedSize = Sizes.IndexOf(Methods.GetSizeString(creature.Size)); DamageReductions = creature.DamageReductions; Immunities = creature.Immunities; EnergyResistances = creature.EnergyResistances; SpellResistance = creature.SpellResistance.ToString(); FastHealing = creature.FastHealing.ToString(); SpecialAttacks = creature.SpecialAttacks; SpecialQualities = creature.SpecialQualities; }
public void SpawnCreature(CreatureTypes type) { var creatureSpawn = GameObjectRegistry.GetObject("creature_spawn"); var creature = DisplayCreature(type, creatureSpawn.transform.position); if (creature == null) { throw new ApplicationException(string.Format("Could not create creature of type '{0}'", type)); } creature.Speed = creature.DefaultSpeed * CreatureSpeedModifier; creature.GrimReaperAppeared += (sender, e) => VoidTargetable(creature); var target = GameObjectRegistry.GetObject("attack_node"); creature.SwimTo(target.transform.position).Float(); if (type == CreatureTypes.Blowfish) { creature.AttackEffects.Clear(); creature.HitEffects.Add(new NukeEffect(creature)); creature.AttackEffects.Add(new RetreatEffect(creature)); } else { creature.HitEffects.Add(new RetreatEffect(creature)); } if (type == CreatureTypes.Shark || type == CreatureTypes.Whale || type == CreatureTypes.RedShark) { creature.EquipWithRandomBaddy(); } AdjustSymbolChainRange(creature); entities.Add(creature); symbolManager.RegisterTargetable(creature); }
private ICreature GetCreature(CreatureTypes creatureType) { CreatureGenerator generator = new CreatureGenerator(); return(generator.GenerateCreature(creatureType)); }
private CreatureIdentification selectCreature(int itemId, CreatureTypes creatureType) { CreatureIdentification item = null; switch (creatureType) { case CreatureTypes.Crustacean: item = new Model.CrustaceanClass(); break; case CreatureTypes.Fish: item = new Model.FishClass(); break; case CreatureTypes.Gastropoda: item = new Model.GastropodaClass(); break; case CreatureTypes.Plant: item = new Model.PlantClass(); break; case CreatureTypes.Reptile: item = new Model.ReptileClass(); break; } if (item != null) // Could check if the creatureType is valid, instead of using 1 switch statement to create the object, and another to set properties { using (MySqlConnection conn = getAConnection()) { if (conn.State != System.Data.ConnectionState.Open) { using (MySqlCommand cmd = new MySqlCommand(SELECT_CREATURE, conn)) { cmd.Parameters.AddWithValue("id", itemId); try { using (MySqlDataReader reader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow)) { if (reader.Read()) { //TODO: Set commen fields switch (creatureType) { case CreatureTypes.Crustacean: //TODO: Set special Crustacean fields break; case CreatureTypes.Fish: //TODO: Set special Crustacean fields break; case CreatureTypes.Gastropoda: //TODO: Set special Crustacean fields break; case CreatureTypes.Plant: //TODO: Set special Crustacean fields break; case CreatureTypes.Reptile: //TODO: Set special Crustacean fields break; } } } } catch (SqlException ex) { handleDBError(new Delegates.DatabaseArgs(ex)); } } } else { handleDBError(new Delegates.DatabaseArgs("Connection not open")); } } } else { handleDBError(new Delegates.DatabaseArgs("creature type is unknown")); } return item; }
public SelectableCard(UInt32 id, CreatureTypes type, byte hp, byte damage, byte mana, byte defense, byte price, Spell spell) : base(id, type, hp, damage, mana, defense, spell) { Price = price; }
public static void CreateCreature(CreatureTypes type, MobileObjectInitialization init) { AddCreature(GetCreatureByNameAndInitParams(type, init)); }
public void Clear() { CreatureTypes.Clear(); Creatures.Clear(); }
public void RemoveCreatureType(string type) { CreatureTypes.Remove(type); }
private CreatureBehaviour DisplayCreature(CreatureTypes type, Vector3 position) { var target = Player.transform.position; var direction = position - target; var leveledPosition = new Vector3(position.x, Environment.SeaLevel, position.z); var quaternion = Quaternion.LookRotation(direction, Vector3.up); var name = GetCreatureResourceByType(type); var root = GameObjectRegistry.GetObject("entity_root"); var gameObject = ResourceManager.CreateInstance<GameObject>(name); gameObject.transform.position = leveledPosition; gameObject.transform.rotation = quaternion; gameObject.transform.parent = root.transform; var billboard = gameObject.GetComponentInChildren<BillboardBehaviour>(); billboard.ApplyOffset(); return gameObject.GetComponentInChildren<CreatureBehaviour>(); }
public ICreature[] GenerateCreatures(CreatureTypes creatureType, int amount) { throw new NotImplementedException(); }
private string GetCreatureResourceByType(CreatureTypes type) { var name = string.Empty; switch (type) { case CreatureTypes.Pike: name = "Creatures/Pike"; break; case CreatureTypes.Shark: name = "Creatures/Shark"; break; case CreatureTypes.Whale: name = "Creatures/Whale"; break; case CreatureTypes.Blowfish: name = "Creatures/Blowfish"; break; case CreatureTypes.RedShark: name = "Creatures/RedShark"; break; case CreatureTypes.RedPike: name = "Creatures/RedPike"; break; } if (string.IsNullOrEmpty(name)) { throw new ApplicationException("creature type unknown."); } return name; }