Documentation

Weapon extends AbstractWeapon
in package
uses RaceID

Defines a concrete realization of a weapon type for ships/planets.

Table of Contents

Constants

BONUS_ACCURACY  : int = 4
BONUS_DAMAGE  : int = 15
HIGHEST_POWER_LEVEL  : int = 5
PLANET_DAMAGE_MOD  : float = 0.2
Reduce the damage done to planets by this factor

Properties

$bonusAccuracy  : bool
$bonusDamage  : bool
$damageRollover  : bool
$raceID  : int
$weaponType  : WeaponType
$weaponTypeID  : int

Methods

canShootTarget()  : bool
getArmourDamage()  : int
Return the weapon armour damage.
getBaseAccuracy()  : int
Return the weapon base accuracy.
getBuyerRestriction()  : BuyerRestriction
getBuyHREF()  : string
getCost()  : int
Weapon cost is increased by 100% for each enhancement present
getDamage()  : WeaponDamage
getModifiedAccuracyAgainstTarget()  : float
getModifiedDamageAgainstTarget()  : WeaponDamage
getModifiedPlanetAccuracy()  : float
getModifiedPlayerAccuracy()  : float
getModifiedPortAccuracy()  : float
getName()  : string
Return weapon name suitable for HTML display.
getPlanetAccuracy()  : float
getPlayerLevelAccuracyMod()  : float
getPowerLevel()  : int
getRaceID()  : int
getRaceName()  : string
getSellHREF()  : string
getShieldDamage()  : int
Return the weapon shield damage.
getWeapon()  : self
getWeaponTypeID()  : int
hasBonusAccuracy()  : bool
hasBonusDamage()  : bool
isDamageRollover()  : bool
isUniqueType()  : bool
Ships are only allowed to equip one of each type of Unique weapon
setBonusAccuracy()  : void
setBonusDamage()  : void
shoot()  : MissedWeaponResult|HitWeaponResult<string|int, TTarget>
__construct()  : mixed
checkHit()  : bool
Given $weaponAccuracy as a percent, decide if the weapon hits.
getWeightedRandom()  : WeightedRandom
hitTarget()  : HitWeaponResult<string|int, TTarget>
Applies this weapon's modified damage and resolves a killing shot, if any.
getNumberOfEnhancements()  : int
hasEnhancements()  : bool

Constants

BONUS_ACCURACY

protected int BONUS_ACCURACY = 4

BONUS_DAMAGE

protected int BONUS_DAMAGE = 15

HIGHEST_POWER_LEVEL

protected int HIGHEST_POWER_LEVEL = 5

PLANET_DAMAGE_MOD

Reduce the damage done to planets by this factor

protected float PLANET_DAMAGE_MOD = 0.2

Properties

$bonusAccuracy

protected bool $bonusAccuracy = false

$bonusDamage

protected bool $bonusDamage = false

$damageRollover

protected bool $damageRollover = false
Attributes
#[Override]

$weaponTypeID read-only

protected int $weaponTypeID

Methods

getArmourDamage()

Return the weapon armour damage.

public getArmourDamage() : int
Return values
int

getBaseAccuracy()

Return the weapon base accuracy.

public getBaseAccuracy() : int
Return values
int

getBuyHREF()

public getBuyHREF(Location $location) : string
Parameters
$location : Location
Return values
string

getCost()

Weapon cost is increased by 100% for each enhancement present

public getCost() : int
Return values
int

getModifiedPlanetAccuracy()

public getModifiedPlanetAccuracy(Planet $planet, Ship $target) : float
Parameters
$planet : Planet
$target : Ship
Return values
float

getModifiedPortAccuracy()

public getModifiedPortAccuracy(Port $port, Ship $target) : float
Parameters
$port : Port
$target : Ship
Return values
float

getName()

Return weapon name suitable for HTML display.

public getName() : string

The name is displayed in green with pluses if enhancements are present.

Return values
string

getPlanetAccuracy()

public getPlanetAccuracy(Planet $planet) : float
Parameters
$planet : Planet
Return values
float

getPlayerLevelAccuracyMod()

public static getPlayerLevelAccuracyMod(Ship $ship) : float
Parameters
$ship : Ship
Return values
float

getPowerLevel()

public getPowerLevel() : int
Return values
int

getRaceID()

public getRaceID() : int
Return values
int

getRaceName()

public getRaceName() : string
Return values
string

getSellHREF()

public getSellHREF(Location $location, int $orderID) : string
Parameters
$location : Location
$orderID : int
Return values
string

getShieldDamage()

Return the weapon shield damage.

public getShieldDamage() : int
Return values
int

getWeapon()

public static getWeapon(int $weaponTypeID[, DatabaseRecord|null $dbRecord = null ]) : self
Parameters
$weaponTypeID : int
$dbRecord : DatabaseRecord|null = null
Return values
self

getWeaponTypeID()

public getWeaponTypeID() : int
Return values
int

hasBonusAccuracy()

public hasBonusAccuracy() : bool
Return values
bool

hasBonusDamage()

public hasBonusDamage() : bool
Return values
bool

isDamageRollover()

public isDamageRollover() : bool
Return values
bool

isUniqueType()

Ships are only allowed to equip one of each type of Unique weapon

public isUniqueType() : bool
Return values
bool

setBonusAccuracy()

public setBonusAccuracy(bool $bonusAccuracy) : void
Parameters
$bonusAccuracy : bool

setBonusDamage()

public setBonusDamage(bool $bonusDamage) : void
Parameters
$bonusDamage : bool

__construct()

protected __construct(int $weaponTypeID[, DatabaseRecord|null $dbRecord = null ]) : mixed
Parameters
$weaponTypeID : int
$dbRecord : DatabaseRecord|null = null

getNumberOfEnhancements()

private getNumberOfEnhancements() : int
Return values
int

hasEnhancements()

private hasEnhancements() : bool
Return values
bool

        
On this page

Search results