Example #1
0
        public void TestShieldDef()
        {
            Character toon = new Character();

            toon.SetBaseStat(Stat.Dexterity, 25);
            toon.SetBaseStat(Stat.Strength, 35);
            toon.SetBaseStat(Stat.Intelligence, 145);
            toon.TrainSkill("Block", 60);
            Assert.That(toon.GetSkillValue("Block"), Is.EqualTo(100));
            toon.EquipItem(Equipments.Get("Red Scutum Shield", null, "of Blocking"));
            Assert.That(toon.Defense, Is.EqualTo(192));
        }
Example #2
0
        public void TestEquipment()
        {
            Character toon = new Character();

            toon.EquipItem(Equipments.Get("Ring", "Ornamented", "of Thurin"), Slot.LeftHand);
            Assert.That(toon.GetEquipmentModifier(Stat.FlatDefense), Is.EqualTo(30));
            toon.EquipItem(Equipments.Get("Ring", "Ornamented", "of Thurin"), Slot.RightHand);
            Assert.That(toon.GetEquipmentModifier(Stat.FlatDefense), Is.EqualTo(60));
            toon.EquipItem(Equipments.Get("Hunting Leather Vest", "Aegis", null), Slot.Chest);
            Assert.That(toon.ArmorWeight, Is.EqualTo(4));
            Assert.That(toon.GetEquipmentModifier(Stat.ArmorDefense), Is.EqualTo(49));
        }
Example #3
0
    public void OnShopList(NetworkMessage msg)
    {
        string    eqId = msg.ReadMessage <StringMessage>().value;
        Equipment eq   = Equipments.Get(eqId);

        screen.newItem.SetText("To buy: " + eq.GetName());
        screen.newItem.SetTooltip(eq.GetDescription());
        screen.newItem.FitSizeToText();
        screen.newItem.SetPosition(screen.newItem.pos, RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER);
        screen.eqToBuy = eqId;
        screen.EnableItemBuy();
    }
Example #4
0
    public void ViewSpellTab(int pawnId)
    {
        for (int j = 0; j < viewPawnImages.Length; j++)
        {
            if (viewPawnImages[j] != null)
            {
                viewPawnImages[j].isVisible = j == pawnId;
            }
        }
        spellPane.OpenTab(pawnId);
        infoPane.OpenTab(0);
        PlayerPawn pawn = battle.allies[pawnId] as PlayerPawn;

        playerName.SetText(pawn.GetName());
        string     affText = "";
        FastString perc    = new FastString(3);

        double affTotal = pawn.GetAffinityTotal();

        for (int i = 0; i < 6; i++)
        {
            perc.Clear();
            double aff = pawn.GetAffinity(i);
            perc.Append((int)(aff / affTotal * 100), 2, FastString.FILL_SPACES);
            affText += "\n" /*+ Element.All[i].GetColorHex()*/ + pawn.GetAffinity(i) + " (" + perc + "%)";
        }
        affinities.SetText(affText);

        foreach (Text text in currentItemTexts)
        {
            RemoveUIObj(text);
        }
        string[] eq       = pawn.GetEquipment();
        int      currentY = size.height - 58;

        for (int i = 0; i < eq.Length; i++)
        {
            Equipment e    = Equipments.Get(eq[i]);
            Text      text = new Text(new Vector2i(5, currentY), new Vector2i(), RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, e.GetName());
            text.FitSizeToText(1);
            text.SetTooltip(e.GetDescription());
            currentY += text.size.height + 2;
            AddUIObj(text);
            currentItemTexts.Add(text);
            bottomPane.AddToTab(1, text);
        }
        UpdateContext();
    }
Example #5
0
        public void TestWeaponDef()
        {
            Character toon = new Character();

            toon.SetBaseStat(Stat.Dexterity, 130);
            toon.SetBaseStat(Stat.Strength, 40);
            toon.SetBaseStat(Stat.Intelligence, 50);
            toon.TrainSkill("Sword", 74);
            toon.TrainSkill("Sword Mastery", 0);
            Assert.That(toon.GetSkill("Sword").UnbuffedSkill, Is.EqualTo(100));
            toon.EquipItem(Equipments.Get("Cutlass", null, null), Slot.RightHand);
            Assert.That(toon.Defense, Is.EqualTo(422));
            toon.EquipItem(Equipments.Get("Braialla's Blade", null, null), Slot.LeftHand);
            Assert.That(toon.Defense, Is.EqualTo(422));
            toon.UnequipItem(Slot.RightHand);
            Assert.That(toon.Defense, Is.EqualTo(458));
        }
Example #6
0
        public void TestDexPenalty()
        {
            Character toon = new Character();

            toon.SetBaseStat(Stat.Dexterity, 85);
            toon.EquipItem(Equipments.Get("Ring Mail Helm", null, null));
            Assert.That(toon.Dexterity, Is.EqualTo(81));
            toon.EquipItem(Equipments.Get("Ring Mail Hauberk", null, null));
            Warn.Unless(toon.Dexterity, Is.EqualTo(73));
            toon.EquipItem(Equipments.Get("Ring Mail Sleeves", null, null));
            Warn.Unless(toon.Dexterity, Is.EqualTo(70));
            Warn.Unless(1, Is.EqualTo(1));
            toon.EquipItem(Equipments.Get("Ring Mail Gauntlets", null, null));
            Warn.Unless(toon.Dexterity, Is.EqualTo(68));
            toon.EquipItem(Equipments.Get("Ring Mail Leggings", null, null));
            Warn.Unless(toon.Dexterity, Is.EqualTo(64));
            toon.EquipItem(Equipments.Get("Ring Mail Boots", null, null));
            Warn.Unless(toon.Dexterity, Is.EqualTo(62));
        }
Example #7
0
        public void TestArmorDef()
        {
            Character toon = new Character();

            toon.SetBaseStat(Stat.Dexterity, 25);
            toon.SetBaseStat(Stat.Intelligence, 145);

            // perfect conc pot:
            toon.AddEffect(Effects.Get("Blessing of Dexterity", 40));
            toon.AddEffect(Effects.Get("Blessed Protection", 40));
            toon.AddEffect(Effects.Get("Prayer of Protection", 40));
            toon.AddEffect(Effects.Get("Charm of Illumination (Spirit)", 40));
            toon.AddEffect(Effects.Get("Charm of Illumination (Intelligence)", 40));

            toon.Stance = Stances.Get("HealerDefense", 20);

            toon.TrainSkill("Wear Armor, Light", 61);
            Assert.That(toon.GetSkill("Wear Armor, Light").UnbuffedSkill, Is.EqualTo(100m));
            Assert.That(toon.GetSkillValue("Wear Armor, Light"), Is.EqualTo(118m));

            toon.EquipItem(Equipments.Get("Hunting Leather Hood", "Aegis", null));
            Assert.That(toon.Dexterity, Is.EqualTo(85));
            Assert.That(toon.Defense, Is.EqualTo(484));
            toon.EquipItem(Equipments.Get("Hunting Leather Vest", "Aegis", null));
            Assert.That(toon.Defense, Is.EqualTo(677));
            toon.EquipItem(Equipments.Get("Hunting Leather Sleeves", "Aegis", null));
            Assert.That(toon.Defense, Is.EqualTo(768));
            toon.EquipItem(Equipments.Get("Hunting Leather Leggings", "Aegis", null));
            Assert.That(toon.Defense, Is.EqualTo(899));
            toon.EquipItem(Equipments.Get("Hunting Leather Boots", "Aegis", null));
            Assert.That(toon.Defense, Is.EqualTo(980));
            toon.EquipItem(Equipments.Get("Hunting Leather Gloves", "Aegis", null));

            //Todo: armor dex penalty is throwing this off
            Warn.Unless(toon.Dexterity, Is.EqualTo(88));
            Warn.Unless(toon.Defense, Is.EqualTo(1061));
        }
Example #8
0
 public void Unequip(string eqId)
 {
     equipped.Remove(eqId);
     Equipments.Get(eqId).OnUnequipped(this);
     OnItemUnequipped.Invoke(null, this, eqId);
 }
Example #9
0
 public void Equip(string eqId)
 {
     equipped.Add(eqId);
     Equipments.Get(eqId).OnEquipped(this);
     OnItemEquipped.Invoke(null, this, eqId);
 }