MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / constructor

Method constructor

code/main/YourselfEntity.ts:5–29  ·  view source on GitHub ↗
(quest: Quest, pos: Pos)

Source from the content-addressed store, hash-verified

3class YourselfEntity extends QuestEntity{
4 // Constructor
5 constructor(quest: Quest, pos: Pos){
6 super(quest,
7 pos,
8 new Naming("Yourself", "yourself"),
9 new RenderArea(3, 1),
10 new Pos(0, 0),
11 new CollisionBoxCollection(new CollisionBox(this, new Pos(0, 0), new Pos(3, 1))),
12 new QuestEntityMovement(new Pos(-1, 0))
13 );
14
15 // Set gravity
16 this.getQuestEntityMovement().setGravity(true);
17
18 // Set destructible
19 this.setDestructible(true);
20 this.setMaxHp(this.getQuest().getGame().getPlayer().getMaxHp());
21 this.setHp(this.getQuest().getGame().getPlayer().getHp());
22
23 // Set the ascii art
24 this.getRenderArea().drawString("\\o/");
25
26 // Set the weapon and its delay
27 this.addQuestEntityWeapon(new QuestEntityWeapon(this.getQuest(), this, new Naming("The same weapon as yours", "the same weapon as yours"), new CollisionBoxCollection(new CollisionBox(this, new Pos(-1, -1), new Pos(5, 3))), 0));
28 this.getLastQuestEntityWeapon().getCloseCombatDelay().setFixedDelay();
29 }
30
31 // setHp()
32 public setHp(hp: number): void{

Callers

nothing calls this directly

Calls 15

setHpMethod · 0.95
setGravityMethod · 0.80
setDestructibleMethod · 0.80
getPlayerMethod · 0.80
getQuestMethod · 0.80
drawStringMethod · 0.80
addQuestEntityWeaponMethod · 0.80
setFixedDelayMethod · 0.80
getCloseCombatDelayMethod · 0.80
setMaxHpMethod · 0.45

Tested by

no test coverage detected