public RoleForm(IRole r, ThreatType type) { this.InitializeComponent(); List <RoleType> roleTypes = new List <RoleType>(); switch (type) { case ThreatType.Creature: { roleTypes.Add(RoleType.Artillery); roleTypes.Add(RoleType.Brute); roleTypes.Add(RoleType.Controller); roleTypes.Add(RoleType.Lurker); roleTypes.Add(RoleType.Skirmisher); roleTypes.Add(RoleType.Soldier); break; } case ThreatType.Trap: { roleTypes.Add(RoleType.Blaster); roleTypes.Add(RoleType.Lurker); roleTypes.Add(RoleType.Obstacle); roleTypes.Add(RoleType.Warder); this.LeaderBox.Text = "This trap is a leader"; break; } } foreach (RoleType roleType in roleTypes) { this.RoleBox.Items.Add(roleType); this.MinionRoleBox.Items.Add(roleType); } foreach (RoleFlag value in Enum.GetValues(typeof(RoleFlag))) { this.ModBox.Items.Add(value); } Application.Idle += new EventHandler(this.Application_Idle); this.fRole = r.Copy(); if (this.fRole is ComplexRole) { this.StandardBtn.Checked = true; ComplexRole complexRole = this.fRole as ComplexRole; this.RoleBox.SelectedItem = complexRole.Type; this.MinionRoleBox.SelectedItem = complexRole.Type; this.ModBox.SelectedItem = complexRole.Flag; this.LeaderBox.Checked = complexRole.Leader; this.HasRoleBox.Checked = false; } if (this.fRole is Minion) { this.MinionBtn.Checked = true; Minion minion = this.fRole as Minion; this.RoleBox.SelectedItem = minion.Type; this.MinionRoleBox.SelectedItem = minion.Type; this.ModBox.SelectedItem = RoleFlag.Standard; this.LeaderBox.Checked = false; this.HasRoleBox.Checked = minion.HasRole; } }
/// <summary> /// Creates a copy of the creature. /// </summary> /// <returns>Returns the copy.</returns> public CustomCreature Copy() { CustomCreature cc = new CustomCreature(); cc.ID = fID; cc.Name = fName; cc.Details = fDetails; cc.Size = fSize; cc.Origin = fOrigin; cc.Type = fType; cc.Keywords = fKeywords; cc.Level = fLevel; cc.Role = fRole.Copy(); cc.Senses = fSenses; cc.Movement = fMovement; cc.Alignment = fAlignment; cc.Languages = fLanguages; cc.Skills = fSkills; cc.Equipment = fEquipment; cc.Strength = fStrength.Copy(); cc.Constitution = fConstitution.Copy(); cc.Dexterity = fDexterity.Copy(); cc.Intelligence = fIntelligence.Copy(); cc.Wisdom = fWisdom.Copy(); cc.Charisma = fCharisma.Copy(); cc.InitiativeModifier = fInitiativeModifier; cc.HPModifier = fHPModifier; cc.ACModifier = fACModifier; cc.FortitudeModifier = fFortitudeModifier; cc.ReflexModifier = fReflexModifier; cc.WillModifier = fWillModifier; cc.Regeneration = (fRegeneration != null) ? fRegeneration.Copy() : null; foreach (Aura aura in fAuras) { cc.Auras.Add(aura.Copy()); } foreach (CreaturePower cp in fCreaturePowers) { cc.CreaturePowers.Add(cp.Copy()); } foreach (DamageModifier dm in fDamageModifiers) { cc.DamageModifiers.Add(dm.Copy()); } cc.Resist = fResist; cc.Vulnerable = fVulnerable; cc.Immune = fImmune; cc.Tactics = fTactics; cc.Image = fImage; return(cc); }
/// <summary> /// Creates a copy of this object. /// </summary> /// <returns>Returns the copy.</returns> public Trap Copy() { Trap t = new Trap(); t.ID = fID; t.Type = fType; t.Name = fName; t.Level = fLevel; t.Role = fRole.Copy(); t.ReadAloud = fReadAloud; t.Description = fDescription; t.Details = fDetails; foreach (TrapSkillData tsd in fSkills) { t.Skills.Add(tsd.Copy()); } t.Initiative = fInitiative; t.Trigger = fTrigger; t.Attack = fAttack != null?fAttack.Copy() : null; foreach (TrapAttack ta in fAttacks) { t.Attacks.Add(ta.Copy()); } foreach (string cm in fCountermeasures) { t.Countermeasures.Add(cm); } return(t); }
public RoleForm(IRole r, ThreatType type) { InitializeComponent(); List <RoleType> roles = new List <RoleType>(); switch (type) { case ThreatType.Creature: roles.Add(RoleType.Artillery); roles.Add(RoleType.Brute); roles.Add(RoleType.Controller); roles.Add(RoleType.Lurker); roles.Add(RoleType.Skirmisher); roles.Add(RoleType.Soldier); break; case ThreatType.Trap: roles.Add(RoleType.Blaster); roles.Add(RoleType.Lurker); roles.Add(RoleType.Obstacle); roles.Add(RoleType.Warder); LeaderBox.Text = "This trap is a leader"; break; } foreach (RoleType role in roles) { RoleBox.Items.Add(role); MinionRoleBox.Items.Add(role); } foreach (RoleFlag flag in Enum.GetValues(typeof(RoleFlag))) { ModBox.Items.Add(flag); } Application.Idle += new EventHandler(Application_Idle); fRole = r.Copy(); if (fRole is ComplexRole) { StandardBtn.Checked = true; ComplexRole cr = fRole as ComplexRole; RoleBox.SelectedItem = cr.Type; MinionRoleBox.SelectedItem = cr.Type; ModBox.SelectedItem = cr.Flag; LeaderBox.Checked = cr.Leader; HasRoleBox.Checked = false; } if (fRole is Minion) { MinionBtn.Checked = true; Minion m = fRole as Minion; RoleBox.SelectedItem = m.Type; MinionRoleBox.SelectedItem = m.Type; ModBox.SelectedItem = RoleFlag.Standard; LeaderBox.Checked = false; HasRoleBox.Checked = m.HasRole; } }