Exemplo n.º 1
0
 public static void ResetWeaponTriangle(
     Weapon_Triangle_Arrow wta1,
     Weapon_Triangle_Arrow wta2)
 {
     wta1.ResetTriangle();
     if (wta2 != null)
     {
         wta2.ResetTriangle();
     }
 }
        protected override Weapon_Triangle_Arrow advantage_arrow(float angle)
        {
            var result = new Weapon_Triangle_Arrow();

            result.value  = WeaponTriangle.Advantage;
            result.offset = new Vector2(
                result.src_rect.Width / 2, result.src_rect.Height / 2);
            result.angle = angle + MathHelper.Pi;
            result.loc   = new Vector2(0, 8) + 12 * new Vector2(
                (float)Math.Cos(angle), (float)Math.Sin(angle));
            return(result);
        }
Exemplo n.º 3
0
 public static void SetWeaponTriangle(
     Weapon_Triangle_Arrow wta,
     Game_Unit attacker,
     Combat_Map_Object target,
     TactileLibrary.Data_Weapon weapon1,
     TactileLibrary.Data_Weapon weapon2,
     int distance)
 {
     SetWeaponTriangle(
         wta, null,
         attacker, target,
         weapon1, weapon2,
         distance);
 }
Exemplo n.º 4
0
        public static void SetWeaponTriangle(
            Weapon_Triangle_Arrow wta1,
            Weapon_Triangle_Arrow wta2,
            Game_Unit attacker,
            Combat_Map_Object target,
            TactileLibrary.Data_Weapon weapon1,
            TactileLibrary.Data_Weapon weapon2,
            int distance)
        {
            //@Yeti: use in all the places weapon triangle arrow is used
            Game_Unit targetUnit = null;

            if (target.is_unit())
            {
                targetUnit = target as Game_Unit;
            }

            ResetWeaponTriangle(wta1, wta2);
            WeaponTriangle tri = WeaponTriangle.Nothing;

            if (targetUnit != null)
            {
                tri = Combat.weapon_triangle(attacker, targetUnit, weapon1, weapon2, distance);
            }
            if (tri != WeaponTriangle.Nothing)
            {
                wta1.value = tri;
                if (wta2 != null && weapon2 != null)
                {
                    wta2.value = Combat.reverse_wta(tri);
                }
            }

            float effectiveness = weapon1.effective_multiplier(attacker, targetUnit, false);

            wta1.set_effectiveness((int)effectiveness,
                                   targetUnit != null && targetUnit.halve_effectiveness());

            if (wta2 != null && weapon2 != null)
            {
                effectiveness = weapon2.effective_multiplier(targetUnit, attacker, false);
                wta2.set_effectiveness((int)effectiveness, attacker.halve_effectiveness());
            }
        }
        public void set_image(Game_Actor actor, Item_Data item_data, int active_item)
        {
            base.set_image(actor, item_data);
            if (!item_data.non_equipment)
            {
                Data_Equipment item = item_data.to_equipment;

                bool useable = false;
                if (active_item >= 0)
                {
                    var  usedItem  = actor.items[active_item].to_item;
                    bool canTarget = usedItem.can_target_item(item_data);
                    useable = canTarget;

                    if (usedItem.can_repair)
                    {
                        if (canTarget)
                        {
                            Arrow       = new Weapon_Triangle_Arrow();
                            Arrow.value = WeaponTriangle.Advantage;

                            int    repairUses = item_data.RepairAmount(usedItem);
                            int    uses       = item_data.UsesAfterRepair(false, repairUses);
                            string color      = uses == item_data.max_uses ? "Green" : "Blue";

                            Uses.SetColor(Global.Content, color);

                            RepairUses = new TextSprite(
                                Config.UI_FONT, Global.Content, color,
                                Vector2.Zero,
                                uses < 0 ? "--" : uses.ToString());

                            Slash.loc   += new Vector2(24, 0);
                            Use_Max.loc += new Vector2(24, 0);
                        }
                    }
                }

                set_text_color(useable);
            }
        }
Exemplo n.º 6
0
 public WeaponTriangleHelp()
 {
     Arrow1 = advantage_arrow(MathHelper.TwoPi * 3 / 12);
     Arrow2 = advantage_arrow(MathHelper.TwoPi * 7 / 12);
     Arrow3 = advantage_arrow(MathHelper.TwoPi * 11 / 12);
 }