Exemple #1
0
 public TempStats(Unit target, StatSet boost, bool oneRoundOnly = false)
 {
     this.target    = target;
     this.boost     = boost;
     IsOneRoundOnly = oneRoundOnly;
     target.Stats.AddSet(boost);
 }
Exemple #2
0
    public SerializedStatSet(StatSet stats)
    {
        hp   = (int)stats[StatTag.HP];
        mhp  = (int)stats[StatTag.MHP];
        str  = (int)stats[StatTag.STR];
        def  = (int)stats[StatTag.DEF];
        agi  = (int)stats[StatTag.AGI];
        mana = (int)stats[StatTag.MANA];

        flagKeys   = new List <StatTag>();
        flagValues = new List <float>();

        foreach (StatTag tag in Enum.GetValues(typeof(StatTag)))
        {
            if (tag == StatTag.NONE)
            {
                continue;
            }
            Stat stat = Stat.Get(tag);
            if (stat.UseBinaryEditor && stats[tag] != 0)
            {
                flagKeys.Add(tag);
                flagValues.Add(stats[tag]);
            }
        }
    }
        public override void InitBeing()
        {
            StatSet stats = (being as IStatBeing).Stats;

            stats["In"].Value = Rng.Random.Next(2) + 9;
            stats["Dx"].Value = Rng.Random.Next(2) + 4;
            stats["St"].Value = Rng.Random.Next(2) + 2;
            stats["To"].Value = Rng.Random.Next(2) + 3;
            stats["Pe"].Value = Rng.Random.Next(2) + 8;

            TempSet temps = (being as ITempsBeing).Temps;

            temps["ring-identification"]     = true;
            temps["neckwear-identification"] = true;
            temps["scroll-identification"]   = true;

            Equipment  equipment = ((IEquipmentBeing)being).Equipment;
            ItemFacade facade    = new ItemFacade();

            equipment.Slots[0].Item = facade.CreateItemById("hat");
            equipment.Slots[2].Item = facade.CreateItemById("kluka");
            equipment.Slots[3].Item = facade.CreateItemById("clothes");

            being.Color = equipment.Slots[3].Item.Color;
        }
Exemple #4
0
        public VhPc()
        {
            equipment = new Equipment(Translator.Instance["equipment"],
                                      new HeadgearSlot(),
                                      new NeckwearSlot(),
                                      new WeaponSlot(),
                                      new ArmorSlot(),
                                      new RingSlot(Translator.Instance["right-ring"]),
                                      new RingSlot(Translator.Instance["left-ring"])
                                      );

            stats = new StatSet(Translator.Instance["stats"],
                                new Stat("St", Translator.Instance["St"], getInitialStatValue()),
                                new Stat("To", Translator.Instance["To"], getInitialStatValue()),
                                new Stat("Dx", Translator.Instance["Dx"], getInitialStatValue()),
                                new Stat("In", Translator.Instance["In"], getInitialStatValue()),
                                new Stat("Pe", Translator.Instance["Pe"], getInitialStatValue())
                                );

            skills = new SkillSet(Translator.Instance["skills"],
                                  new VhSkill("swimming", Translator.Instance["swimming"], 0, Stats["Dx"], Stats["In"]),
                                  new VhSkill("digging", Translator.Instance["digging"], 0, Stats["St"], Stats["In"]),
                                  new VhSkill("searching", Translator.Instance["searching"], 0, Stats["Pe"], Stats["In"]),
                                  new VhSkill("identification", Translator.Instance["identification"], 0, Stats["In"], Stats["In"]),
                                  new VhSkill("magick", Translator.Instance["magick"], 0, Stats["In"], Stats["In"]),
                                  new VhSkill("reading", Translator.Instance["reading"], 0, Stats["In"], Stats["In"])
                                  );

            Accusativ = Translator.Instance["you"];
            race      = "human";
        }
        /// <summary>
        /// Creates a new character with the given name, max health, stats and moves.
        /// </summary>
        public Character(
            string name,
            string team,
            int maxHealth,
            StatSet stats,
            MoveSet moves,
            Ability ability)
        {
            Id   = Guid.NewGuid().ToString();
            Name = name;
            Team = team;

            MaxHealth     = maxHealth;
            CurrentHealth = maxHealth;

            Stats = stats;
            Moves = moves;

            AbilitySlot = new AbilitySlot();
            AbilitySlot.Set(ability);

            ItemSlot = new ItemSlot();

            ProtectQueue = new List <Character>();
            ProtectLimit = 1;
        }
Exemple #6
0
        public override void InitBeing()
        {
            StatSet stats = (being as IStatBeing).Stats;

            stats["In"].Value = Rng.Random.Next(2) + 5;
            stats["Dx"].Value = Rng.Random.Next(2) + 7;
            stats["St"].Value = Rng.Random.Next(2) + 5;
            stats["To"].Value = Rng.Random.Next(2) + 4;
            stats["Pe"].Value = Rng.Random.Next(2) + 5;

            TempSet temps = (being as ITempsBeing).Temps;

            temps["potion-identification"] = true;
            if (Rng.Random.NextFloat() > 0.5f)
            {
                temps["illness-resistance"] = true;
            }
            else
            {
                temps["illness-resistance"] = true;
            }

            Equipment  equipment = ((IEquipmentBeing)being).Equipment;
            ItemFacade facade    = new ItemFacade();

            equipment.Slots[0].Item = facade.CreateItemById("hat");
            equipment.Slots[2].Item = facade.CreateItemById("knife");
            equipment.Slots[3].Item = facade.CreateItemById("clothes");

            being.Color = equipment.Slots[3].Item.Color;
        }
Exemple #7
0
 public void RemoveSet(StatSet other)
 {
     foreach (StatTag tag in Enum.GetValues(typeof(StatTag)))
     {
         stats[tag] = Stat.Get(tag).combinator.Decombine(stats[tag], other.stats[tag]);
     }
 }
Exemple #8
0
        protected override void OnInitialize()
        {
            //InitializeMappings();

            StatSet         statSet         = StatSets.CreateWarriorStatSet(Owner);
            HealthComponent healthComponent = new HealthComponent(Owner, statSet);
            WeaponComponent weaponComponent = new WeaponComponent(Owner, Weapons.CreateSlicerClaymore());

            Owner.AddComponent(statSet);
            Owner.AddComponent(healthComponent);
            Owner.AddComponent(weaponComponent);

            Owner.InitializeComponents();

            spriterComponent.ChangeAnimation("Idle");
            spriterComponent.Scale = 0.4f;

            spriterComponent.OnAnimationChanged += spriterComponent_OnAnimationChanged;
            Owner.FirstComponentOfType <Wallet>().AddCoins(7000f);
            Owner.FirstComponentOfType <TargetingComponent>().Ignore("player");

            r = new DamageRenderer(Owner);
            r.Initialize();
            r.Color = Color.Green;

            Owner.AddComponent(r);
        }
Exemple #9
0
 public Item(String name, StatSet stats, ItemType type, String textureName, ItemClass itemClass)
 {
     this.name        = name;
     this.stats       = stats;
     this.textureName = textureName;
     this.type        = type;
     this.itemClass   = itemClass;
 }
Exemple #10
0
    public MaskedMan()
    {
        Name = "Masked Man";
        MaxHP = 188;
        MaxMP = 223;
        Stats = new StatSet
        {
            Strength = 9,
            Defence = 10,
            Evade = 2,
            Magic = 8,
            MagicDefence = 10,
            MagicEvade = 3,
            Attack = 8,
            Spirit = 10,
            Speed = 19
        };

        Steals = new ItemStealSet
        {
            Common = ItemManager.Consumables.GetById(1),
            Uncommon = ItemManager.Armours.GetById(29),
            Rare = ItemManager.Weapons.GetById(2)
        };

        StatusImmunities = new List<StatusEffect>
        {
            { StatusEffect.Berserk },
            { StatusEffect.Confuse },
            { StatusEffect.Darkness },
            { StatusEffect.Death },
            { StatusEffect.Doom },
            { StatusEffect.Float },
            { StatusEffect.Freeze },
            { StatusEffect.Haste },
            { StatusEffect.Heat },
            { StatusEffect.Mini },
            { StatusEffect.Petrify },
            { StatusEffect.Poison },
            { StatusEffect.Protect },
            { StatusEffect.Reflect },
            { StatusEffect.Regen },
            { StatusEffect.Shell },
            { StatusEffect.Silence },
            { StatusEffect.Sleep },
            { StatusEffect.Slow },
            { StatusEffect.Stop },
            { StatusEffect.Trouble },
            { StatusEffect.Vanish },
            { StatusEffect.Venom }
        };

        CommandAbilities = new List<CommandAbility>
        {
            { new AttackAbility() }
        };
    }
Exemple #11
0
        public static Item fromXML(XmlElement element)
        {
            ItemType  type = (ItemType)Enum.Parse(typeof(ItemType), element.GetAttribute("type"));
            ItemClass itemClass = (ItemClass)Enum.Parse(typeof(ItemClass), element.GetAttribute("class"));
            String    name = element.GetAttribute("name"), textureName = element.GetAttribute("textureName");
            StatSet   stats = StatSet.fromXML((XmlElement)element.GetElementsByTagName("stats").Item(0));

            return(new Item(name, stats, type, textureName, itemClass));
        }
Exemple #12
0
        public static Item generateItem(Being being)
        {
            ItemType  type        = rollType(being);
            ItemClass itemClass   = rollClass(being);
            StatSet   stats       = rollStats(being, itemClass, type);
            String    name        = rollName(being, itemClass, type, stats);
            String    textureName = Enum.GetName(typeof(ItemType), type) + rand.Next(4);

            return(new Item(name, stats, type, textureName, itemClass));
        }
 /// <summary>
 /// Creates a new <see cref="Player"/> instance.
 /// </summary>
 public Player(
     IUserInput userInput,
     string name,
     string team,
     int maxHealth,
     StatSet stats,
     MoveSet moves) : base(name, team, maxHealth, stats, moves)
 {
     _userInput = userInput;
 }
Exemple #14
0
 public void AddSet(StatSet other)
 {
     foreach (StatTag tag in Enum.GetValues(typeof(StatTag)))
     {
         if (other.stats.ContainsKey(tag))
         {
             stats[tag] = Stat.Get(tag).combinator.Combine(stats[tag], other.stats[tag]);
         }
     }
 }
 public BattleActor()
 {
     statusEffects     = new List <Status> ();
     removeStatusQueue = new List <Status> ();
     equipment         = new List <Equipment> ();
     skillsKnown       = new List <Skill> ();
     skillsEquipped    = new List <Skill> ();
     inventory         = new List <Item> ();
     stats             = new StatSet();
 }
 /// <summary>
 /// Creates a new basic character with the given name, max health, stats and moves.
 /// </summary>
 public BasicCharacter(
     string name,
     string team,
     int maxHealth,
     StatSet stats,
     MoveSet moves,
     Ability ability,
     Random random) : base(name, team, maxHealth, stats, moves, ability)
 {
     _random = random ?? throw new ArgumentNullException(nameof(random));
 }
Exemple #17
0
    public void Populate(StatSet stats)
    {
        var tag = Stat.Get(stat).NameShort;

        if (tag.Length < 4)
        {
            tag += ":";
        }
        label.text = tag;
        value.text = Mathf.FloorToInt(stats[stat]).ToString();
    }
Exemple #18
0
 public StatSet(StatSet other) : this()
 {
     foreach (StatTag tag in Enum.GetValues(typeof(StatTag)))
     {
         Stat stat = Stat.Get(tag);
         if (stat == null)
         {
             continue;
         }
         stats[tag] = other[tag];
     }
 }
Exemple #19
0
 public StatSet RemoveSet(StatSet other)
 {
     foreach (StatTag tag in Enum.GetValues(typeof(StatTag)))
     {
         if (tag == StatTag.NONE)
         {
             continue;
         }
         stats[tag] = Stat.Get(tag).Combinator.Decombine(stats[tag], other.stats[tag]);
     }
     return(this);
 }
Exemple #20
0
        private void spriterComponent_OnAnimationFinished(SaNi.Spriter.Data.SpriterAnimation animation)
        {
            spriterComponent.OnAnimationFinished -= spriterComponent_OnAnimationFinished;
            if (animation.Name != "Attack")
            {
                return;
            }

            GameObject target = Owner.FirstComponentOfType <TargetingComponent>().Target;

            spriterComponent.ChangeAnimation("Idle");
            // ei ole targettia
            if (target == null)
            {
                return;
            }

            // TODO siirrä johonkin komponenttiin kun on tarpeeksi abseja
            HealthComponent healthComponent = target.FirstComponentOfType <HealthComponent>();

            // Targettia vastaan ei voi hyökätä.
            if (healthComponent == null)
            {
                return;
            }

            WeaponComponent weaponComponent = Owner.FirstComponentOfType <WeaponComponent>();
            StatSet         statSet         = Owner.FirstComponentOfType <StatSet>();

            bool isCrit = false;

            float damage = weaponComponent.GenerateAttack(statSet.GetAttackPower(), statSet.GetCritPercent(), ref isCrit);

            r.AddText(((int)damage).ToString(), isCrit);

            healthComponent.TakeDamage(damage);

            SpriterEffect effect = new SpriterEffect(Owner, @"Animations/Splatters");

            effect.Initialize();
            effect.SpriterComponent.Position = target.Position + new Vector2(24f, -38f);

            if (target.ContainsTag("boss"))
            {
                effect.SpriterComponent.Scale = 2.5f;
            }

            effect.SpriterComponent.FlipX = Owner.FirstComponentOfType <FacingComponent>().FacingNumber < 0f;
            effect.SpriterComponent.ChangeAnimation("blood_ribon_0");

            Owner.AddComponent(effect);
        }
Exemple #21
0
    public override async Task ResolveAsync(Intent intent)
    {
        var battle   = intent.Battle;
        var user     = intent.Actor;
        var username = user.Name;
        var stat     = Stat.Get(data.stat);
        var statname = stat.NameLong;
        var itemname = intent.Item.Name;
        var tab      = BattleBox.Tab;
        var targets  = intent.Targets;
        int power    = data.power;

        if (data.powerStat != StatTag.NONE)
        {
            power += user[data.powerStat];
        }
        await battle.WriteLineAsync(username + " uses " + itemname + ".");

        await PlayBattleAnimAsync(intent);

        foreach (var victim in targets)
        {
            var  victimname = victim.Name;
            var  boost      = power;
            bool limited    = false;
            if (data.cap != 0 && victim[stat.Tag] + boost > data.cap)
            {
                boost   = data.cap - victim[stat.Tag];
                limited = true;
            }
            var mod = new StatSet();
            mod[stat.Tag] = boost;
            battle.AddBoost(victim, mod);
            if (boost > 0)
            {
                if (limited)
                {
                    await battle.WriteLineAsync(tab + victimname + "'s " + statname + " is up to " + data.cap + ".");
                }
                else
                {
                    await battle.WriteLineAsync(tab + victimname + "'s " + statname + " is up by " + boost + ".");
                }
            }
            else
            {
                await battle.WriteLineAsync(tab + "Nothing happens.");
            }
        }
    }
Exemple #22
0
        protected void copyValues(XmlElement element)
        {
            StatSet stats = StatSet.fromXML((XmlElement)element.GetElementsByTagName("stats").Item(0));

            xp            = int.Parse(element.GetAttribute("xp"));
            level         = int.Parse(element.GetAttribute("level"));
            unusedAttr    = int.Parse(element.GetAttribute("unusedAttr"));
            xpOfNextLevel = int.Parse(element.GetAttribute("xpOfNextLevel"));
            guid          = new Guid(element.GetAttribute("guid"));
            unlocked      = UnlockedManager.fromXML((XmlElement)element.GetElementsByTagName("levelsUnlocked").Item(0));
            foreach (Stat stat in stats.statsTable.Values)
            {
                this.stats.setStatValue(stat.getType(), stat.getValue());
            }
            itemManager = InventoryManager.fromXML((XmlElement)element.GetElementsByTagName("inventory").Item(0));
        }
Exemple #23
0
        public override bool Perform()
        {
            TempSet temps = (Performer as ITempsBeing).Temps;

            notify("bitter");
            if (Rng.Random.NextFloat() < PETRIFICATION_RESISTANCE_RATE)
            {
                temps["petrification-resistance"] = true;
                if (Performer is IStatBeing)
                {
                    StatSet stats = (Performer as IStatBeing).Stats;
                    stats["St"].Value -= 1;
                }
                notify("petrification-resistance");
            }
            return(true);
        }
    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        StatSet     set  = new StatSet();
        StatModData data = serializer.Deserialize <StatModData>(reader);

        foreach (StatEntryData stat in data.stats)
        {
            set[stat.stat] = stat.value;
        }
        if (data.flags != null)
        {
            foreach (StatTag flag in data.flags)
            {
                set[flag] = 1;
            }
        }
        return(set);
    }
Exemple #25
0
    public Amarant()
    {
        Name = "Amarant";
        Portrait = File.ReadAllBytes("Assets/Textures/Characters/Amarant/Amarant-Portrait.png");

        BaseStats = new StatSet
        {
            Speed = 22,
            Strength = 22,
            Magic = 13,
            Spirit = 15
        };

        Gear = new GearSet
        {
            Weapon = ItemManager.Weapons.GetById(1),
            Head = ItemManager.Armours.GetById(3)
        };
    }
Exemple #26
0
    public Quina()
    {
        Name = "Quina";
        Portrait = File.ReadAllBytes("Assets/Textures/Characters/Quina/Quina-Portrait.png");

        BaseStats = new StatSet
        {
            Speed = 14,
            Strength = 18,
            Magic = 20,
            Spirit = 11
        };

        Gear = new GearSet
        {
            Weapon = ItemManager.Weapons.GetById(1),
            Head = ItemManager.Armours.GetById(3)
        };
    }
Exemple #27
0
        public override void FromXml(XmlElement element)
        {
            base.FromXml(element);
            health    = GetIntAttribute(HEALTH);
            equipment = GetElement(EQUIPMENT) as Equipment;

            skills = GetElement(SKILLS) as SkillSet;
            stats  = GetElement(STATS) as StatSet;
            foreach (Skill skill in skills)
            {
                VhSkill vhSkill = skill as VhSkill;
                vhSkill.Stat         = Stats[vhSkill.StatId];
                vhSkill.LearningStat = Stats[vhSkill.LearningStatId];
            }

            backpack         = GetElement(BACKPACK) as StackingBackPack;
            profession       = GetElement(PROFESSION) as AbstractProfession;
            profession.Being = this;
        }
Exemple #28
0
 public StatSet AddSet(StatSet other)
 {
     foreach (StatTag tag in Enum.GetValues(typeof(StatTag)))
     {
         if (tag == StatTag.NONE)
         {
             continue;
         }
         if (other.stats.ContainsKey(tag))
         {
             float val1 = 0;
             float val2 = 0;
             stats.TryGetValue(tag, out val1);
             other.stats.TryGetValue(tag, out val2);
             stats[tag] = Stat.Get(tag).Combinator.Combine(val1, val2);
         }
     }
     return(this);
 }
Exemple #29
0
    public Garnet()
    {
        Name = "Garnet";
        Portrait = File.ReadAllBytes("Assets/Textures/Characters/Garnet/Garnet-Portrait.png");

        BaseStats = new StatSet
        {
            Speed = 21,
            Strength = 14,
            Magic = 23,
            Spirit = 17
        };

        Gear = new GearSet
        {
            Weapon = ItemManager.Weapons.GetById(16),
            Body = ItemManager.Armours.GetById(89)
        };
    }
Exemple #30
0
    public PC(int racei)
    {
        //TODO Clean
        X    = 225;
        Y    = 500;
        Race = (RaceUtils.Race)racei;
        switch (Race)
        {
        case RaceUtils.Race.Pirate:
            Anim  = new AnimationSet(@"creatures\pc\pirate\anim.xml");
            Stats = new StatSet(@"creatures\pc\pirate\stat.xml");
            Size  = 12;
            Name  = "NANCY";
            break;

        case RaceUtils.Race.Dragon:
            Anim  = new AnimationSet(@"creatures\pc\dragon\anim.xml");
            Stats = new StatSet(@"creatures\pc\dragon\stat.xml");
            Size  = 16;
            Name  = "ALESSIA";
            break;

        case RaceUtils.Race.Meximage:
            Anim  = new AnimationSet(@"creatures\pc\meximage\anim.xml");
            Stats = new StatSet(@"creatures\pc\meximage\stat.xml");
            Size  = 14;
            Name  = "JESUS";
            break;

        case RaceUtils.Race.Ninja:
            Anim  = new AnimationSet(@"creatures\pc\ninja\anim.xml");
            Stats = new StatSet(@"creatures\pc\ninja\stat.xml");
            Size  = 12;
            Name  = "BIP";
            break;
        }

        //fix!
        Anim.Speed = 9;
        HP         = Stats.Vit();
        MP         = Stats.Aff();
        FA         = MaxFatigue;
    }
Exemple #31
0
    public Zidane()
    {
        Name = "Zidane";
        Portrait = File.ReadAllBytes("Assets/Textures/Characters/Zidane/Zidane-Portrait.png");

        BaseStats = new StatSet
        {
            Speed = 23,
            Strength = 21,
            Magic = 18,
            Spirit = 23
        };

        Gear = new GearSet
        {
            Weapon = ItemManager.Weapons.GetById(1),
            Head = ItemManager.Armours.GetById(3)
        };
    }
Exemple #32
0
    public Eiko()
    {
        Name = "Eiko";
        Portrait = File.ReadAllBytes("Assets/Textures/Characters/Eiko/Eiko-Portrait.png");

        BaseStats = new StatSet
        {
            Speed = 19,
            Strength = 13,
            Magic = 21,
            Spirit = 18
        };

        Gear = new GearSet
        {
            Weapon = ItemManager.Weapons.GetById(1),
            Head = ItemManager.Armours.GetById(3)
        };
    }
Exemple #33
0
    public Freya()
    {
        Name = "Freya";
        Portrait = File.ReadAllBytes("Assets/Textures/Characters/Freya/Freya-Portrait.png");

        BaseStats = new StatSet
        {
            Speed = 20,
            Strength = 20,
            Magic = 16,
            Spirit = 22
        };

        Gear = new GearSet
        {
            Weapon = ItemManager.Weapons.GetById(1),
            Head = ItemManager.Armours.GetById(3)
        };
    }
    public int statSetParse(StatSet statSet, string formula)
    {
        string parsable = "";

        string[] form = formula.Split(' ');
        foreach (string element in form)
        {
            if (element.StartsWith("caster."))
            {
                //Debug.Log(element.Substring(7, element.Length-7));
                parsable += statSet.getStat(element.Substring(7, element.Length - 7));
            }
            else
            {
                parsable += element;
            }
        }
        return((int)(Parse(parsable, false)));
    }
Exemple #35
0
    public Stenier()
    {
        Name = "Stenier";
        Portrait = File.ReadAllBytes("Assets/Textures/Characters/Stenier/Stenier-Portrait.png");

        BaseStats = new StatSet
        {
            Speed = 18,
            Strength = 24,
            Magic = 12,
            Spirit = 21
        };

        Gear = new GearSet
        {
            Weapon = ItemManager.Weapons.GetById(35),
            Head = ItemManager.Armours.GetById(26),
            Body = ItemManager.Armours.GetById(72)
        };
    }
Exemple #36
0
    public Vivi()
    {
        Name = "Vivi";
        Portrait = File.ReadAllBytes("Assets/Textures/Characters/Vivi/Vivi-Portrait.png");

        BaseStats = new StatSet
        {
            Speed = 16,
            Strength = 12,
            Magic = 24,
            Spirit = 19
        };

        Gear = new GearSet
        {
            Weapon = ItemManager.Weapons.GetById(50),
            Head = ItemManager.Armours.GetById(2),
            Body = ItemManager.Armours.GetById(53)
        };
    }
Exemple #37
0
    public PC(int racei)
    {
        //TODO Clean
        X = 225;
        Y = 500;
        Race = (RaceUtils.Race)racei;
        switch (Race)
        {
            case RaceUtils.Race.Pirate:
                Anim = new AnimationSet(@"creatures\pc\pirate\anim.xml");
                Stats = new StatSet(@"creatures\pc\pirate\stat.xml");
                Size = 12;
                Name = "NANCY";
                break;
            case RaceUtils.Race.Dragon:
                Anim = new AnimationSet(@"creatures\pc\dragon\anim.xml");
                Stats = new StatSet(@"creatures\pc\dragon\stat.xml");
                Size = 16;
                Name = "ALESSIA";
                break;
            case RaceUtils.Race.Meximage:
                Anim = new AnimationSet(@"creatures\pc\meximage\anim.xml");
                Stats = new StatSet(@"creatures\pc\meximage\stat.xml");
                Size = 14;
                Name = "JESUS";
                break;
            case RaceUtils.Race.Ninja:
                Anim = new AnimationSet(@"creatures\pc\ninja\anim.xml");
                Stats = new StatSet(@"creatures\pc\ninja\stat.xml");
                Size = 12;
                Name = "BIP";
                break;

        }

        //fix!
        Anim.Speed = 9;
        HP = Stats.Vit();
        MP = Stats.Aff();
        FA = MaxFatigue;
    }
Exemple #38
0
        public override void InitBeing()
        {
            StatSet stats = (being as IStatBeing).Stats;

            stats["In"].Value = Rng.Random.Next(2) + 2;
            stats["Dx"].Value = Rng.Random.Next(2) + 2;
            stats["St"].Value = Rng.Random.Next(2) + 7;
            stats["To"].Value = Rng.Random.Next(2) + 7;
            stats["Pe"].Value = Rng.Random.Next(2) + 4;

            TempSet temps = (being as ITempsBeing).Temps;

            //temps["blindness-resistance"] = true;
            temps["confusion-resistance"] = true;
            temps["booze-identification"] = true;

            Equipment  equipment = (being as IEquipmentBeing).Equipment;
            ItemFacade facade    = new ItemFacade();

            equipment.Slots[0].Item = facade.CreateItemById("felt-beret");
            equipment.Slots[2].Item = facade.CreateItemById("spade");
            equipment.Slots[3].Item = facade.CreateItemById("felt-jacket");

            StackingBackPack backpack = (being as IBackPackBeing).BackPack;

            backpack.Add(facade.CreateItemById("booze"));
            backpack.Add(facade.CreateItemById("booze"));
            backpack.Add(facade.CreateItemById("potion-of-amnesia"));

            foreach (Item item in backpack.Items)
            {
                if (item is MagicalItem)
                {
                    (item as MagicalItem).Identify();
                }
            }

            being.Color = equipment.Slots[3].Item.Color;
        }
Exemple #39
0
        public override bool Perform()
        {
            bool result = base.Perform();

            if (Rng.Random.NextFloat() < SUCK_RATE)
            {
                if (Attackee is IStatBeing)
                {
                    StatSet stats = (Attackee as IStatBeing).Stats;
                    Stat    st    = stats["St"];
                    if (st != null)
                    {
                        if (st.Value > 1)
                        {
                            st.Value--;
                            notify("suck-strength", Attackee);
                            return(true);
                        }
                    }
                }
            }
            return(result);
        }
Exemple #40
0
    protected override async Task ApplyEffect(Intent intent, Unit target, int power)
    {
        var victimname = target.Name;
        var tab        = BattleBox.Tab;
        var statName   = Stat.Get(data.drainStat).NameLong;
        var battle     = intent.Battle;

        var debuffMult = power / 100f;

        if (data.defendStat != StatTag.NONE)
        {
            debuffMult -= target[data.defendStat] * 0.66f / 100f;
        }
        if (debuffMult > .5f)
        {
            debuffMult = .5f;
        }
        var finalStat   = (int)(target[data.drainStat] * (1.0f - debuffMult));
        var debuffPower = target[data.drainStat] - finalStat;

        if (finalStat < 0)
        {
            debuffPower = target[data.drainStat];
        }
        if (debuffPower > 0)
        {
            var mod = new StatSet();
            mod[data.drainStat] = -1 * debuffPower;
            battle.AddBoost(target, mod);
            await battle.WriteLineAsync(tab + victimname + "'s " + statName + " is down by " + debuffPower + ".");
        }
        else
        {
            await battle.WriteLineAsync("Nothing happens.");
        }
    }
Exemple #41
0
    public static StatSet operator -(StatSet lhs, StatSet rhs)
    {
        if (ReferenceEquals(lhs, null))
            lhs = new StatSet();

        if (ReferenceEquals(rhs, null))
            rhs = new StatSet();

        return new StatSet()
        {
            Speed = lhs.Speed - rhs.Speed,
            Strength = lhs.Strength - rhs.Strength,
            Magic = lhs.Magic - rhs.Magic,
            Spirit = lhs.Spirit - rhs.Spirit,
            Attack = lhs.Attack - rhs.Attack,
            Defence = lhs.Defence - rhs.Defence,
            Evade = lhs.Evade - rhs.Evade,
            MagicDefence = lhs.MagicDefence - rhs.MagicDefence,
            MagicEvade = lhs.MagicEvade - rhs.MagicEvade
        };
    }
Exemple #42
0
 public Character()
 {
     Stats = new StatSet(this);
 }
Exemple #43
0
    private StatSet CalculateStatIncrease()
    {
        StatSet statIncrease = new StatSet();

        int speedBonus = Gear.Stats.Speed;
        int strengthBonus = Gear.Stats.Strength;
        int magicBonus = Gear.Stats.Magic;
        int spiritBonus = Gear.Stats.Spirit;

        statIncrease.Speed = (byte)((BaseStats.Speed + Math.Floor((double)(Level * 1 / 10)) + Math.Floor((double)((Stats.Speed - BaseStats.Speed) / 32)) + speedBonus) - Stats.Speed);
        statIncrease.Strength = (byte)((BaseStats.Strength + Math.Floor((double)(Level * 3 / 10)) + Math.Floor((double)(levelUpCounter * 3 + (Stats.Strength - BaseStats.Strength)) / 32) + strengthBonus) - Stats.Strength);
        statIncrease.Magic = (byte)((BaseStats.Magic + Math.Floor((double)(Level * 3 / 10)) + Math.Floor((double)(levelUpCounter * 3 + (Stats.Magic - BaseStats.Magic)) / 32) + magicBonus) - Stats.Magic);
        statIncrease.Spirit = (byte)((BaseStats.Spirit + Math.Floor((double)(Level * 3 / 20)) + Math.Floor((double)(levelUpCounter * 1 + (Stats.Spirit - BaseStats.Spirit)) / 32) + spiritBonus) - Stats.Spirit);

        return statIncrease;
    }