public CreatureSkillsForm(ICreature creature) { this.InitializeComponent(); Application.Idle += new EventHandler(this.Application_Idle); this.fCreature = creature; Dictionary <string, int> strs = CreatureHelper.ParseSkills(this.fCreature.Skills); foreach (string skillName in Skills.GetSkillNames()) { int level = this.fCreature.Level / 2; int modifier = 0; string keyAbility = Skills.GetKeyAbility(skillName); string str = keyAbility; if (keyAbility != null) { if (str == "Strength") { modifier = this.fCreature.Strength.Modifier; } else if (str == "Constitution") { modifier = this.fCreature.Constitution.Modifier; } else if (str == "Dexterity") { modifier = this.fCreature.Dexterity.Modifier; } else if (str == "Intelligence") { modifier = this.fCreature.Intelligence.Modifier; } else if (str == "Wisdom") { modifier = this.fCreature.Wisdom.Modifier; } else if (str == "Charisma") { modifier = this.fCreature.Charisma.Modifier; } } CreatureSkillsForm.SkillData skillDatum = new CreatureSkillsForm.SkillData() { SkillName = skillName, Ability = modifier, Level = level }; if (strs.ContainsKey(skillName)) { int item = strs[skillName] - (modifier + level); if (item > 3) { skillDatum.Trained = true; item -= 5; } skillDatum.Misc = item; } this.fSkills.Add(skillDatum); } this.update_list(); }
void Awake() { ExecuteOnMainThread = new Queue <Action>(); _creatureHelper = GameObject.Find("GameManager").GetComponent <CreatureHelper>(); _player = Networking.Network.Instance.ClientPlayer; _creatureHelper.Creatures = new List <AbstractCreature>(); MustAttack = false; _canMove = false; GameFlow.Instance.Channel = new NetworkMessageChannel(_player); GameFlow.Instance.Channel.MoveCallback += DrawPath; GameFlow.Instance.Channel.TurnCallback += ChangeTurn; GameFlow.Instance.Channel.SyncHeroesCallback += SyncHero; GameFlow.Instance.Channel.Attack += Attack; GameFlow.Instance.Channel.GameIsReadyCallback += GameIsReady; GameFlow.Instance.Channel.DieCallback += Die; GameFlow.Instance.Channel.FinishGame += FinishGame; Messenger <TileBehaviour> .AddListener("Tile selected", MoveCreatureToSelectedTile); Messenger <CreatureComponent> .AddListener("Action finish", FinishAction); Messenger <CreatureComponent> .AddListener("CreatureComponent Selected", MouseOverCreature); Messenger <CreatureComponent> .AddListener("CreatureComponent Exit", MouseExitCreature); Messenger <CreatureComponent> .AddListener("CreatureComponent Attack", MouseClickCreature); _hero1Obj = Instantiate(Hero1Prefab) as GameObject; _hero2Obj = Instantiate(Hero2Prefab) as GameObject; _prefabCollector = PrefabDatabase.GetComponent <PrefabCollector>(); _creaturePrefabDictionary.Add("Marksman", "GoblinHex"); _creaturePrefabDictionary.Add("Troglodyte", "OrcHex"); _creatureHelper.PlayerLeft.text = GameFlow.Instance.PlayerLeftName; _creatureHelper.PlayerRight.text = GameFlow.Instance.PlayerRightName; _imageDictionary = new Dictionary <NetworkTypes.CreatureType, Sprite>() { { NetworkTypes.CreatureType.Range, _prefabCollector.CreatureImages.SingleOrDefault(x => x.Name == "Range").Image }, { NetworkTypes.CreatureType.Melee, _prefabCollector.CreatureImages.SingleOrDefault(x => x.Name == "Melee").Image } }; var roomName = new SimpleMessage { Message = GameFlow.Instance.RoomName }; var parameters = new List <SerializableType> { roomName }; var remoteInvokeMethod = new RemoteInvokeMethod("", Command.InitializeBoard, parameters); Client.BeginSendPackage(remoteInvokeMethod); }
public void Awake() { if (transform.GetChild(0).GetComponent <Animator>() != null) { _anim = transform.GetChild(0).GetComponent <Animator>(); } Status = CreatureStatus.Alive; var manager = GameObject.Find("GameManager"); if (manager != null) { creatureHelper = manager.GetComponent <CreatureHelper>(); } _current = 0; _move = false; }
public CustomCreature(ICreature c) { CreatureHelper.CopyFields(c, this); }
public void Update() { if (this.fID == Guid.Empty) { this.fID = Guid.NewGuid(); } foreach (Creature fCreature in this.fCreatures) { if (fCreature == null) { continue; } if (fCreature.Category == null) { fCreature.Category = ""; } if (fCreature.Senses == null) { fCreature.Senses = ""; } if (fCreature.Movement == null) { fCreature.Movement = ""; } if (fCreature.Auras == null) { fCreature.Auras = new List <Aura>(); } foreach (Aura aura in fCreature.Auras) { if (aura.Keywords != null) { continue; } aura.Keywords = ""; } if (fCreature.CreaturePowers == null) { fCreature.CreaturePowers = new List <CreaturePower>(); } if (fCreature.DamageModifiers == null) { fCreature.DamageModifiers = new List <DamageModifier>(); } foreach (CreaturePower creaturePower in fCreature.CreaturePowers) { if (creaturePower.Condition == null) { creaturePower.Condition = ""; } creaturePower.ExtractAttackDetails(); } CreatureHelper.UpdateRegen(fCreature); foreach (CreaturePower creaturePower1 in fCreature.CreaturePowers) { CreatureHelper.UpdatePowerRange(fCreature, creaturePower1); } if (fCreature.Tactics == null) { fCreature.Tactics = ""; } if (fCreature.URL == null) { fCreature.URL = ""; } if (fCreature.Image == null) { continue; } Program.SetResolution(fCreature.Image); } foreach (CreatureTemplate fTemplate in this.fTemplates) { if (fTemplate == null) { continue; } if (fTemplate.Senses == null) { fTemplate.Senses = ""; } if (fTemplate.Movement == null) { fTemplate.Movement = ""; } if (fTemplate.Auras == null) { fTemplate.Auras = new List <Aura>(); } foreach (Aura aura1 in fTemplate.Auras) { if (aura1.Keywords != null) { continue; } aura1.Keywords = ""; } if (fTemplate.CreaturePowers == null) { fTemplate.CreaturePowers = new List <CreaturePower>(); } if (fTemplate.DamageModifierTemplates == null) { fTemplate.DamageModifierTemplates = new List <DamageModifierTemplate>(); } foreach (CreaturePower creaturePower2 in fTemplate.CreaturePowers) { if (creaturePower2.Condition == null) { creaturePower2.Condition = ""; } creaturePower2.ExtractAttackDetails(); } if (fTemplate.Tactics != null) { continue; } fTemplate.Tactics = ""; } if (this.fThemes == null) { this.fThemes = new List <MonsterTheme>(); } foreach (MonsterTheme fTheme in this.fThemes) { if (fTheme == null) { continue; } foreach (ThemePowerData power in fTheme.Powers) { power.Power.ExtractAttackDetails(); } } if (this.fTraps == null) { this.fTraps = new List <Trap>(); } foreach (Trap fTrap in this.fTraps) { if (fTrap.Description == null) { fTrap.Description = ""; } if (fTrap.Attacks == null) { fTrap.Attacks = new List <TrapAttack>(); } if (fTrap.Attack != null) { fTrap.Attacks.Add(fTrap.Attack); fTrap.Initiative = (fTrap.Attack.HasInitiative ? fTrap.Attack.Initiative : -2147483648); fTrap.Trigger = fTrap.Attack.Trigger; fTrap.Attack = null; } foreach (TrapAttack attack in fTrap.Attacks) { if (attack.ID == Guid.Empty) { attack.ID = Guid.NewGuid(); } if (attack.Name == null) { attack.Name = "Attack"; } if (attack.Keywords == null) { attack.Keywords = ""; } if (attack.Notes != null) { continue; } attack.Notes = ""; } if (fTrap.Trigger == null) { fTrap.Trigger = ""; } foreach (TrapSkillData skill in fTrap.Skills) { if (skill.ID != Guid.Empty) { continue; } skill.ID = Guid.NewGuid(); } } if (this.fSkillChallenges == null) { this.fSkillChallenges = new List <SkillChallenge>(); } foreach (SkillChallenge fSkillChallenge in this.fSkillChallenges) { if (fSkillChallenge.Notes == null) { fSkillChallenge.Notes = ""; } foreach (SkillChallengeData skillChallengeResult in fSkillChallenge.Skills) { if (skillChallengeResult.Results != null) { continue; } skillChallengeResult.Results = new SkillChallengeResult(); } } if (this.fMagicItems == null) { this.fMagicItems = new List <MagicItem>(); } if (this.fArtifacts == null) { this.fArtifacts = new List <Artifact>(); } foreach (Tile fTile in this.fTiles) { Program.SetResolution(fTile.Image); if (fTile.Keywords != null) { continue; } fTile.Keywords = ""; } if (this.fTerrainPowers == null) { this.fTerrainPowers = new List <TerrainPower>(); } }
/// <summary> /// Updates the library to the latest format. /// </summary> public void Update() { if (fID == Guid.Empty) { fID = Guid.NewGuid(); } foreach (Creature c in fCreatures) { if (c == null) { continue; } if (c.Category == null) { c.Category = ""; } if (c.Senses == null) { c.Senses = ""; } if (c.Movement == null) { c.Movement = ""; } if (c.Auras == null) { c.Auras = new List <Aura>(); } foreach (Aura aura in c.Auras) { if (aura.Keywords == null) { aura.Keywords = ""; } } if (c.CreaturePowers == null) { c.CreaturePowers = new List <CreaturePower>(); } if (c.DamageModifiers == null) { c.DamageModifiers = new List <DamageModifier>(); } foreach (CreaturePower cp in c.CreaturePowers) { if (cp.Condition == null) { cp.Condition = ""; } cp.ExtractAttackDetails(); } CreatureHelper.UpdateRegen(c); foreach (CreaturePower power in c.CreaturePowers) { CreatureHelper.UpdatePowerRange(c, power); } if (c.Tactics == null) { c.Tactics = ""; } if (c.Image != null) { Program.SetResolution(c.Image); } } foreach (CreatureTemplate ct in fTemplates) { if (ct == null) { continue; } if (ct.Senses == null) { ct.Senses = ""; } if (ct.Movement == null) { ct.Movement = ""; } if (ct.Auras == null) { ct.Auras = new List <Aura>(); } foreach (Aura aura in ct.Auras) { if (aura.Keywords == null) { aura.Keywords = ""; } } if (ct.CreaturePowers == null) { ct.CreaturePowers = new List <CreaturePower>(); } if (ct.DamageModifierTemplates == null) { ct.DamageModifierTemplates = new List <DamageModifierTemplate>(); } foreach (CreaturePower cp in ct.CreaturePowers) { if (cp.Condition == null) { cp.Condition = ""; } cp.ExtractAttackDetails(); } if (ct.Tactics == null) { ct.Tactics = ""; } } if (fThemes == null) { fThemes = new List <MonsterTheme>(); } foreach (MonsterTheme mt in fThemes) { if (mt == null) { continue; } foreach (ThemePowerData tpd in mt.Powers) { tpd.Power.ExtractAttackDetails(); } } if (fTraps == null) { fTraps = new List <Trap>(); } foreach (Trap t in fTraps) { if (t.Description == null) { t.Description = ""; } if (t.Attacks == null) { t.Attacks = new List <TrapAttack>(); } if (t.Attack != null) { t.Attacks.Add(t.Attack); t.Initiative = t.Attack.HasInitiative ? t.Attack.Initiative : int.MinValue; t.Trigger = t.Attack.Trigger; t.Attack = null; } foreach (TrapAttack ta in t.Attacks) { if (ta.ID == Guid.Empty) { ta.ID = Guid.NewGuid(); } if (ta.Name == null) { ta.Name = "Attack"; } if (ta.Keywords == null) { ta.Keywords = ""; } if (ta.Notes == null) { ta.Notes = ""; } } if (t.Trigger == null) { t.Trigger = ""; } foreach (TrapSkillData tsd in t.Skills) { if (tsd.ID == Guid.Empty) { tsd.ID = Guid.NewGuid(); } } } if (fSkillChallenges == null) { fSkillChallenges = new List <SkillChallenge>(); } foreach (SkillChallenge sc in fSkillChallenges) { if (sc.Notes == null) { sc.Notes = ""; } foreach (SkillChallengeData scd in sc.Skills) { if (scd.Results == null) { scd.Results = new SkillChallengeResult(); } } } if (fMagicItems == null) { fMagicItems = new List <MagicItem>(); } if (fArtifacts == null) { fArtifacts = new List <Artifact>(); } foreach (Tile t in fTiles) { Program.SetResolution(t.Image); if (t.Keywords == null) { t.Keywords = ""; } } if (fTerrainPowers == null) { fTerrainPowers = new List <TerrainPower>(); } }
public CreatureSkillsForm(ICreature creature) { InitializeComponent(); Application.Idle += new EventHandler(Application_Idle); fCreature = creature; Dictionary <string, int> skills = CreatureHelper.ParseSkills(fCreature.Skills); foreach (string skill_name in Skills.GetSkillNames()) { int level = fCreature.Level / 2; int ability = 0; string ability_name = Skills.GetKeyAbility(skill_name); switch (ability_name) { case "Strength": ability = fCreature.Strength.Modifier; break; case "Constitution": ability = fCreature.Constitution.Modifier; break; case "Dexterity": ability = fCreature.Dexterity.Modifier; break; case "Intelligence": ability = fCreature.Intelligence.Modifier; break; case "Wisdom": ability = fCreature.Wisdom.Modifier; break; case "Charisma": ability = fCreature.Charisma.Modifier; break; } SkillData sd = new SkillData(); sd.SkillName = skill_name; sd.Ability = ability; sd.Level = level; if (skills.ContainsKey(skill_name)) { int total = skills[skill_name]; int misc = total - (ability + level); if (misc > 3) { sd.Trained = true; misc -= 5; } sd.Misc = misc; } fSkills.Add(sd); } update_list(); }