Exemple #1
0
 internal override void CommandOperation()
 {
     if (Owner is Model.Element)
     {
         AssociatedElements.Add((Model.Element)Owner);
     }
     createdAttribute = Owner.AddAttribute();
     if (createdAttributeHolder != null)
     {
         createdAttributeHolder.Element = createdAttribute;
     }
     createdAttribute.Name  = Name;
     createdAttribute.Lower = Lower;
     if (Type != null && Type.Element != null)
     {
         createdAttribute.Type = Type.Element;
     }
     if (Upper.HasValue)
     {
         createdAttribute.Upper = Upper.Value;
     }
     createdAttribute.Default = Default;
 }
Exemple #2
0
        public BenefitResolution ResolveMaterialBenefit()
        {
            var result = new BenefitResolution()
            {
                pick = BenefitPick.None
            };

            var roll = dice.roll();

            if (Owner.Culture == Constants.CultureType.Darrian)
            {
                if (RankNumber >= 5 || Owner.Profile.Soc.Value >= 11)
                {
                    roll++;
                }
            }
            else if (Owner.Culture == Constants.CultureType.Aslan)
            {
                if (Owner.Profile.Soc.Value >= 9)
                {
                    roll++;
                }
                if (Owner.Sex.Equals(Properties.Resources.Sex_Male))
                {
                    roll++;
                }
            }
            else
            {
                if (RankNumber >= 5 || Owner.Skills.ContainsKey(SkillLibrary.Prospecting.Name))
                {
                    roll++;
                }
            }
            roll = roll.Clamp(1, Material.Count);
            var benefit = Material[roll - 1];

            result.benefit = benefit;
            if (Culture.BenefitAllowed(Owner, benefit))
            {
                if (benefit.TypeOfBenefit == Benefit.BenefitType.Material)
                {
                    Owner.AddBenefit(benefit);
                }
                else if (benefit.TypeOfBenefit == Benefit.BenefitType.Skill)
                {
                    Owner.AddSkill(new Skill()
                    {
                        Class = Skill.SkillClass.None,
                        Name  = benefit.Name,
                        Level = benefit.Value
                    });
                }
                else if (benefit.TypeOfBenefit == Benefit.BenefitType.AttributeModification)
                {
                    Owner.AddAttribute(benefit.Name, benefit.Value);
                }
                else if (benefit.TypeOfBenefit == Benefit.BenefitType.Weapon)
                {
                    result.pick = ResolveWeaponBenefit();
                }
                else if (benefit.TypeOfBenefit != Benefit.BenefitType.None)
                {
                    Owner.AddBenefit(benefit);
                }
            }
            else
            {
                Owner.Journal.Add(string.Format(Properties.Resources.Msg_BenefitNotAllowed, benefit.Name, benefit.Value));
            }
            return(result);
        }