GetMap() public method

public GetMap ( ) : Map
return Map
Ejemplo n.º 1
0
        public UInt16Array ChooseAttackPosition(Critter npc, Critter target, AttackChoice attackChoice)
        {
            var weapon = npc.GetItemById (attackChoice.WeaponId);
            if (weapon == null)
                return null;

            var weaponDistance = weapon.Proto.WeaponMaxDist (attackChoice.WeaponUse);
            var distance = Global.GetDistance (npc, target);

            if (weaponDistance < distance) {
                var direction = Global.GetDirection (npc, target);
                var hexX = npc.HexX;
                var hexY = npc.HexY;

                do {
                    npc.GetMap ().MoveHexByDir (ref hexX, ref hexY, direction, 1);
                } while(!npc.GetMap ().IsHexPassed (hexX, hexY));

                var result = new UInt16Array ();
                result.Add (hexX);
                result.Add (hexY);
                result.Add ((ushort)direction);
                return result;
            }

            return null;
        }
Ejemplo n.º 2
0
        public static bool AddAttackPlane(this Critter npc, uint priority, Critter target)
        {
            if (npc.IsPlayer)
            {
                Map  map = npc.GetMap();
                uint loc = 0;
                if (map != null)
                {
                    loc = map.GetLocation().GetProtoId();
                }
                Global.Log("ERR: adding attack plane to player, loc pid={0}", loc);
            }
            NpcPlane plane = Global.CreatePlane();

            plane.Type            = PlaneType.Attack;
            plane.Priority        = (priority == 0?Priorities.Attack:priority);
            plane.Attack_TargId   = target.Id;
            plane.Attack_MinHp    = Global.DeadHitPoints;
            plane.Attack_IsGag    = false;
            plane.Attack_GagHexX  = 0;
            plane.Attack_GagHexY  = 0;
            plane.Attack_LastHexX = target.HexX;
            plane.Attack_LastHexY = target.HexY;
            plane.Run             = false;
            return(npc.AddPlane(plane));
        }
Ejemplo n.º 3
0
        public Critter ChooseNextTarget(Critter npc, Critter currentTarget)
        {
            var enemyStack = new UIntArray ();
            npc.GetEnemyStack (enemyStack);

            for (int i = 0; i < enemyStack.Length; i++) {
                if (enemyStack [i] != 0) {
                    var target = npc.GetMap ().GetCritter (enemyStack [i]);
                    if (target != null)
                        return target;
                }
            }

            return null;
        }