Weapon
extends AbstractWeapon
in package
uses
RaceID
Defines a concrete realization of a weapon type for ships/planets.
Table of Contents
Constants
- BONUS_ACCURACY = 4
- BONUS_DAMAGE = 15
- HIGHEST_POWER_LEVEL = 5
- PLANET_DAMAGE_MOD = 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
- canShootForces() : bool
- canShootPlanets() : bool
- canShootPorts() : bool
- canShootTraders() : 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() : WeaponDamageData
- getModifiedAccuracy() : float
- getModifiedAccuracyAgainstForces() : float
- getModifiedAccuracyAgainstPlanet() : float
- getModifiedAccuracyAgainstPlayer() : float
- getModifiedAccuracyAgainstPort() : float
- getModifiedDamageAgainstForces() : WeaponDamageData
- getModifiedDamageAgainstPlanet() : WeaponDamageData
- getModifiedDamageAgainstPlayer() : WeaponDamageData
- getModifiedDamageAgainstPort() : WeaponDamageData
- getModifiedForceDamageAgainstPlayer() : WeaponDamageData
- getModifiedPlanetAccuracy() : float
- getModifiedPlanetAccuracyAgainstPlayer() : float
- getModifiedPlanetDamageAgainstPlayer() : WeaponDamageData
- getModifiedPortAccuracy() : float
- getModifiedPortAccuracyAgainstPlayer() : float
- getModifiedPortDamageAgainstPlayer() : WeaponDamageData
- getName() : string
- Return weapon name suitable for HTML display.
- 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
- shootForces() : ForceTakenDamageData, KillResults?: array{}}
- shootPlanet() : TakenDamageData, KillResults?: array{}}
- shootPlayer() : TakenDamageData, KillResults?: array{DeadExp: int, KillerExp: int, KillerCredits: int}}
- shootPlayerAsForce() : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
- shootPlayerAsPlanet() : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
- shootPlayerAsPort() : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
- shootPort() : TakenDamageData, KillResults?: array{}}
- __construct() : mixed
- checkHit() : bool
- Given $weaponAccuracy as a percent, decide if the weapon hits.
- doForceDamageToPlayer() : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
- doPlanetDamageToPlayer() : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
- doPlayerDamageToForce() : ForceTakenDamageData, KillResults?: array{}}
- doPlayerDamageToPlanet() : TakenDamageData, KillResults?: array{}}
- doPlayerDamageToPlayer() : TakenDamageData, KillResults?: array{DeadExp: int, KillerExp: int, KillerCredits: int}}
- doPlayerDamageToPort() : TakenDamageData, KillResults?: array{}}
- doPortDamageToPlayer() : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
- getWeightedRandomForPlayer() : WeightedRandom
- getNumberOfEnhancements() : int
- hasEnhancements() : bool
Constants
BONUS_ACCURACY
protected
mixed
BONUS_ACCURACY
= 4
BONUS_DAMAGE
protected
mixed
BONUS_DAMAGE
= 15
HIGHEST_POWER_LEVEL
protected
mixed
HIGHEST_POWER_LEVEL
= 5
PLANET_DAMAGE_MOD
Reduce the damage done to planets by this factor
protected
mixed
PLANET_DAMAGE_MOD
= 0.2
Properties
$bonusAccuracy
protected
bool
$bonusAccuracy
= false
$bonusDamage
protected
bool
$bonusDamage
= false
$damageRollover
protected
bool
$damageRollover
= false
$raceID
protected
int
$raceID
$weaponType read-only
protected
WeaponType
$weaponType
$weaponTypeID read-only
protected
int
$weaponTypeID
Methods
canShootForces()
public
canShootForces() : bool
Return values
boolcanShootPlanets()
public
canShootPlanets() : bool
Return values
boolcanShootPorts()
public
canShootPorts() : bool
Return values
boolcanShootTraders()
public
canShootTraders() : bool
Return values
boolgetArmourDamage()
Return the weapon armour damage.
public
getArmourDamage() : int
Return values
intgetBaseAccuracy()
Return the weapon base accuracy.
public
getBaseAccuracy() : int
Return values
intgetBuyerRestriction()
public
getBuyerRestriction() : BuyerRestriction
Return values
BuyerRestrictiongetBuyHREF()
public
getBuyHREF(Location $location) : string
Parameters
- $location : Location
Return values
stringgetCost()
Weapon cost is increased by 100% for each enhancement present
public
getCost() : int
Return values
intgetDamage()
public
getDamage() : WeaponDamageData
Return values
WeaponDamageDatagetModifiedAccuracy()
public
getModifiedAccuracy(AbstractPlayer $weaponPlayer) : float
Parameters
- $weaponPlayer : AbstractPlayer
Return values
floatgetModifiedAccuracyAgainstForces()
public
getModifiedAccuracyAgainstForces(AbstractPlayer $weaponPlayer, Force $forces) : float
Parameters
- $weaponPlayer : AbstractPlayer
- $forces : Force
Return values
floatgetModifiedAccuracyAgainstPlanet()
public
getModifiedAccuracyAgainstPlanet(AbstractPlayer $weaponPlayer, Planet $planet) : float
Parameters
- $weaponPlayer : AbstractPlayer
- $planet : Planet
Return values
floatgetModifiedAccuracyAgainstPlayer()
public
getModifiedAccuracyAgainstPlayer(AbstractPlayer $weaponPlayer, AbstractPlayer $targetPlayer) : float
Parameters
- $weaponPlayer : AbstractPlayer
- $targetPlayer : AbstractPlayer
Return values
floatgetModifiedAccuracyAgainstPort()
public
getModifiedAccuracyAgainstPort(AbstractPlayer $weaponPlayer, Port $port) : float
Parameters
- $weaponPlayer : AbstractPlayer
- $port : Port
Return values
floatgetModifiedDamageAgainstForces()
public
getModifiedDamageAgainstForces(AbstractPlayer $weaponPlayer, Force $forces) : WeaponDamageData
Parameters
- $weaponPlayer : AbstractPlayer
- $forces : Force
Return values
WeaponDamageDatagetModifiedDamageAgainstPlanet()
public
getModifiedDamageAgainstPlanet(AbstractPlayer $weaponPlayer, Planet $planet) : WeaponDamageData
Parameters
- $weaponPlayer : AbstractPlayer
- $planet : Planet
Return values
WeaponDamageDatagetModifiedDamageAgainstPlayer()
public
getModifiedDamageAgainstPlayer(AbstractPlayer $weaponPlayer, AbstractPlayer $targetPlayer) : WeaponDamageData
Parameters
- $weaponPlayer : AbstractPlayer
- $targetPlayer : AbstractPlayer
Return values
WeaponDamageDatagetModifiedDamageAgainstPort()
public
getModifiedDamageAgainstPort(AbstractPlayer $weaponPlayer, Port $port) : WeaponDamageData
Parameters
- $weaponPlayer : AbstractPlayer
- $port : Port
Return values
WeaponDamageDatagetModifiedForceDamageAgainstPlayer()
public
getModifiedForceDamageAgainstPlayer(Force $forces, AbstractPlayer $targetPlayer) : WeaponDamageData
Parameters
- $forces : Force
- $targetPlayer : AbstractPlayer
Return values
WeaponDamageDatagetModifiedPlanetAccuracy()
public
getModifiedPlanetAccuracy(Planet $planet) : float
Parameters
- $planet : Planet
Return values
floatgetModifiedPlanetAccuracyAgainstPlayer()
public
getModifiedPlanetAccuracyAgainstPlayer(Planet $planet, AbstractPlayer $targetPlayer) : float
Parameters
- $planet : Planet
- $targetPlayer : AbstractPlayer
Return values
floatgetModifiedPlanetDamageAgainstPlayer()
public
getModifiedPlanetDamageAgainstPlayer(Planet $planet, AbstractPlayer $targetPlayer) : WeaponDamageData
Parameters
- $planet : Planet
- $targetPlayer : AbstractPlayer
Return values
WeaponDamageDatagetModifiedPortAccuracy()
public
getModifiedPortAccuracy(Port $port) : float
Parameters
- $port : Port
Return values
floatgetModifiedPortAccuracyAgainstPlayer()
public
getModifiedPortAccuracyAgainstPlayer(Port $port, AbstractPlayer $targetPlayer) : float
Parameters
- $port : Port
- $targetPlayer : AbstractPlayer
Return values
floatgetModifiedPortDamageAgainstPlayer()
public
getModifiedPortDamageAgainstPlayer(Port $port, AbstractPlayer $targetPlayer) : WeaponDamageData
Parameters
- $port : Port
- $targetPlayer : AbstractPlayer
Return values
WeaponDamageDatagetName()
Return weapon name suitable for HTML display.
public
getName() : string
The name is displayed in green with pluses if enhancements are present.
Return values
stringgetPlayerLevelAccuracyMod()
public
static getPlayerLevelAccuracyMod(AbstractPlayer $player) : float
Parameters
- $player : AbstractPlayer
Return values
floatgetPowerLevel()
public
getPowerLevel() : int
Return values
intgetRaceID()
public
getRaceID() : int
Return values
intgetRaceName()
public
getRaceName() : string
Return values
stringgetSellHREF()
public
getSellHREF(Location $location, int $orderID) : string
Parameters
- $location : Location
- $orderID : int
Return values
stringgetShieldDamage()
Return the weapon shield damage.
public
getShieldDamage() : int
Return values
intgetWeapon()
public
static getWeapon(int $weaponTypeID[, DatabaseRecord|null $dbRecord = null ]) : self
Parameters
- $weaponTypeID : int
- $dbRecord : DatabaseRecord|null = null
Return values
selfgetWeaponTypeID()
public
getWeaponTypeID() : int
Return values
inthasBonusAccuracy()
public
hasBonusAccuracy() : bool
Return values
boolhasBonusDamage()
public
hasBonusDamage() : bool
Return values
boolisDamageRollover()
public
isDamageRollover() : bool
Return values
boolisUniqueType()
Ships are only allowed to equip one of each type of Unique weapon
public
isUniqueType() : bool
Return values
boolsetBonusAccuracy()
public
setBonusAccuracy(bool $bonusAccuracy) : void
Parameters
- $bonusAccuracy : bool
setBonusDamage()
public
setBonusDamage(bool $bonusDamage) : void
Parameters
- $bonusDamage : bool
shootForces()
public
shootForces(AbstractPlayer $weaponPlayer, Force $forces) : ForceTakenDamageData, KillResults?: array{}}
Parameters
- $weaponPlayer : AbstractPlayer
- $forces : Force
Return values
ForceTakenDamageData, KillResults?: array{}}shootPlanet()
public
shootPlanet(AbstractPlayer $weaponPlayer, Planet $planet) : TakenDamageData, KillResults?: array{}}
Parameters
- $weaponPlayer : AbstractPlayer
- $planet : Planet
Return values
TakenDamageData, KillResults?: array{}}shootPlayer()
public
shootPlayer(AbstractPlayer $weaponPlayer, AbstractPlayer $targetPlayer) : TakenDamageData, KillResults?: array{DeadExp: int, KillerExp: int, KillerCredits: int}}
Parameters
- $weaponPlayer : AbstractPlayer
- $targetPlayer : AbstractPlayer
Return values
TakenDamageData, KillResults?: array{DeadExp: int, KillerExp: int, KillerCredits: int}}shootPlayerAsForce()
public
shootPlayerAsForce(Force $forces, AbstractPlayer $targetPlayer) : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
Parameters
- $forces : Force
- $targetPlayer : AbstractPlayer
Return values
TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}shootPlayerAsPlanet()
public
shootPlayerAsPlanet(Planet $planet, AbstractPlayer $targetPlayer) : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
Parameters
- $planet : Planet
- $targetPlayer : AbstractPlayer
Return values
TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}shootPlayerAsPort()
public
shootPlayerAsPort(Port $port, AbstractPlayer $targetPlayer) : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
Parameters
- $port : Port
- $targetPlayer : AbstractPlayer
Return values
TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}shootPort()
public
shootPort(AbstractPlayer $weaponPlayer, Port $port) : TakenDamageData, KillResults?: array{}}
Parameters
- $weaponPlayer : AbstractPlayer
- $port : Port
Return values
TakenDamageData, KillResults?: array{}}__construct()
protected
__construct(int $weaponTypeID[, DatabaseRecord|null $dbRecord = null ]) : mixed
Parameters
- $weaponTypeID : int
- $dbRecord : DatabaseRecord|null = null
checkHit()
Given $weaponAccuracy as a percent, decide if the weapon hits.
protected
checkHit(AbstractPlayer $player, float $weaponAccuracy) : bool
Parameters
- $player : AbstractPlayer
- $weaponAccuracy : float
Return values
booldoForceDamageToPlayer()
protected
doForceDamageToPlayer(AbstractPlayer, Hit: bool} $return, Force $forces, AbstractPlayer $targetPlayer) : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
Parameters
- $return : AbstractPlayer, Hit: bool}
- $forces : Force
- $targetPlayer : AbstractPlayer
Return values
TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}doPlanetDamageToPlayer()
protected
doPlanetDamageToPlayer(AbstractPlayer, Hit: bool} $return, Planet $planet, AbstractPlayer $targetPlayer) : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
Parameters
- $return : AbstractPlayer, Hit: bool}
- $planet : Planet
- $targetPlayer : AbstractPlayer
Return values
TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}doPlayerDamageToForce()
protected
doPlayerDamageToForce(Force, Hit: bool} $return, AbstractPlayer $weaponPlayer, Force $forces) : ForceTakenDamageData, KillResults?: array{}}
Parameters
- $return : Force, Hit: bool}
- $weaponPlayer : AbstractPlayer
- $forces : Force
Return values
ForceTakenDamageData, KillResults?: array{}}doPlayerDamageToPlanet()
protected
doPlayerDamageToPlanet(Planet, Hit: bool} $return, AbstractPlayer $weaponPlayer, Planet $planet) : TakenDamageData, KillResults?: array{}}
Parameters
- $return : Planet, Hit: bool}
- $weaponPlayer : AbstractPlayer
- $planet : Planet
Return values
TakenDamageData, KillResults?: array{}}doPlayerDamageToPlayer()
protected
doPlayerDamageToPlayer(AbstractPlayer, Hit: bool} $return, AbstractPlayer $weaponPlayer, AbstractPlayer $targetPlayer) : TakenDamageData, KillResults?: array{DeadExp: int, KillerExp: int, KillerCredits: int}}
Parameters
- $return : AbstractPlayer, Hit: bool}
- $weaponPlayer : AbstractPlayer
- $targetPlayer : AbstractPlayer
Return values
TakenDamageData, KillResults?: array{DeadExp: int, KillerExp: int, KillerCredits: int}}doPlayerDamageToPort()
protected
doPlayerDamageToPort(Port, Hit: bool} $return, AbstractPlayer $weaponPlayer, Port $port) : TakenDamageData, KillResults?: array{}}
Parameters
- $return : Port, Hit: bool}
- $weaponPlayer : AbstractPlayer
- $port : Port
Return values
TakenDamageData, KillResults?: array{}}doPortDamageToPlayer()
protected
doPortDamageToPlayer(AbstractPlayer, Hit: bool} $return, Port $port, AbstractPlayer $targetPlayer) : TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}
Parameters
- $return : AbstractPlayer, Hit: bool}
- $port : Port
- $targetPlayer : AbstractPlayer
Return values
TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}getWeightedRandomForPlayer()
protected
getWeightedRandomForPlayer(AbstractPlayer $player) : WeightedRandom
Parameters
- $player : AbstractPlayer
Return values
WeightedRandomgetNumberOfEnhancements()
private
getNumberOfEnhancements() : int
Return values
inthasEnhancements()
private
hasEnhancements() : bool