コード例 #1
0
        // Second overload method used for checking abilities that target tiles (Move for example)
        public static bool IsAbilityUseValid(LivingEntity caster, Ability abilityUsed, Tile targetTile)
        {
            // Ability must pass both checks to be a valid move
            bool passedApCheck      = false;
            bool passedInRangeCheck = false;

            // Check if caster actually has enough action points to pay for the ability
            if (HasEnoughActionPoints(caster, abilityUsed))
            {
                passedApCheck = true;
            }

            // Check that the target location is in range
            if (WorldController.IsTileAInRangeOfTileB(caster.Position, targetTile, abilityUsed.Range))
            {
                passedInRangeCheck = true;
            }

            // both checks succesful? if so, return true
            if (passedApCheck &&
                passedInRangeCheck)
            {
                return(true);
            }
            else
            {
                return(false);
            }


            // TO DO: implement code that checks if the targetTile is unoccupied when using 'Move'
        }
コード例 #2
0
 public static bool IsTargetInRangeOfCaster(LivingEntity target, LivingEntity caster, int range)
 {
     return(WorldController.IsTileAInRangeOfTileB(target.Position, caster.Position, range));
 }