RuneHive-Game
Loading...
Searching...
No Matches
ProjectileTest.java
Go to the documentation of this file.
1package com.runehive.game;
2
3import com.runehive.game.world.entity.mob.Mob;
4import com.runehive.game.world.position.Position;
5
6public class ProjectileTest {
7
10
12 int projectileId, int speed, int delay, int startHeight, int endHeight,
13 int curve, int creatorSize, int startDistanceOffset, int stepMultiplier) {
14 this.start = start;
15 this.target = end;
16 this.offset = new Position((end.getX() - start.getX()),
17 (end.getY() - start.getY()));
18 this.creatorSize = creatorSize;
19 this.startDistanceOffset = startDistanceOffset;
20 this.lockon = lockon;
21 this.projectileId = projectileId;
22 this.delay = delay;
23 this.speed = speed;
24 this.startHeight = startHeight;
25 this.endHeight = endHeight;
26 this.slope = curve;
27 this.angle = getAngle();
28 this.radius = getRadius();
29 this.stepMultiplier = stepMultiplier;
30 }
31
32 public ProjectileTest(Mob source, Mob victim, int projectileId,
33 int delay, int speed, int startHeight, int endHeight, int curve, int creatorSize, int stepMultiplier) {
34 this(source.getPosition(), victim.getPosition(),
35 (victim.isPlayer() ? -victim.getIndex() - 1
36 : victim.getIndex() + 1), projectileId, speed, delay,
38 }
39
41 int projectileId, int speed, int delay, int startHeight, int endHeight,
42 int curve) {
43 this(start, end, lockon, projectileId, speed, delay, startHeight, endHeight, curve, 1, 0, 0);
44 }
45
49
50 public int getLockon() {
51 return this.lockon;
52 }
53
54 public int getProjectileId() {
55 return this.projectileId;
56 }
57
58 public int getStepMultiplier() {
59 return stepMultiplier;
60 }
61
62 public int getSlope() {
63 return this.slope;
64 }
65
66 public int getEndHeight() {
67 return this.endHeight;
68 }
69
70 public int getStartHeight() {
71 return this.startHeight;
72 }
73
74 public int getSpeed() {
75 return this.speed;
76 }
77
78 public int getDelay() {
79 return this.delay;
80 }
81
82 public int getCreatorSize() {
83 return this.creatorSize;
84 }
85
87 return this.offset;
88 }
89
91 return this.startDistanceOffset;
92 }
93
94 public Position getStart() {
95 return this.start;
96 }
97
99 return this.target;
100 }
101
102 public int getAngle() {
103 return this.angle;
104 }
105
106 public int getRadius() {
107 return this.radius;
108 }
109
110 public int getDuration(int distance) {
111 if (distance > 0) {
112 return this.delay + (distance * this.stepMultiplier);
113 }
114 return 0;
115 }
116
117 public int getHitDelay(int distance) {
118 return (int) Math.floor(getDuration(distance) / 30D) + 1; //might be - 1
119 }
120}
121
ProjectileTest(Position start, Position end, int lockon, int projectileId, int speed, int delay, int startHeight, int endHeight, int curve)
ProjectileTest(Position start, Position end, int lockon, int projectileId, int speed, int delay, int startHeight, int endHeight, int curve, int creatorSize, int startDistanceOffset, int stepMultiplier)
ProjectileTest(Position source, Position delta, int slope, int speed, int projectileId, int startHeight, int endHeight, int lockon, int delay, int creatorSize, int startDistanceOffset)
ProjectileTest(Mob source, Mob victim, int projectileId, int delay, int speed, int startHeight, int endHeight, int curve, int creatorSize, int stepMultiplier)
Handles the mob class.
Definition Mob.java:66
final boolean isPlayer()
Check if an entity is a player.
Definition Mob.java:564
Represents a single tile on the game world.
Definition Position.java:14
int getY()
Gets the absolute y coordinate.
Definition Position.java:46
int getX()
Gets the absolute x coordinate.
Definition Position.java:41