@@ -40,7 +40,7 @@ public routerSnake(float x, float y, boolean canDecay, int length){
40
40
41
41
public void update (){
42
42
i += Time .delta ;
43
- if (i > 10f ){
43
+ if (i > routerSnakeMod . snakeUpdateDelay ){
44
44
if (length < 1 ){
45
45
routerSnakeMod .snakes .remove (this );
46
46
return ;
@@ -63,63 +63,62 @@ public void update(){
63
63
};
64
64
if (y > routerSnakeMod .worldHeight ){
65
65
heading = 270f ;
66
- }else if (y < 0 ){
66
+ }else if (y < 0f ){
67
67
heading = 90f ;
68
68
};
69
- heading += Mathf .random (-18f , 18f );
70
- x += Mathf .cosDeg (heading ) * 10f ;
71
- y += Mathf .sinDeg (heading ) * 10f ;
72
- if (Mathf .chance (0.008f ) && Groups .player .size () > 0 ){
69
+ heading += Mathf .random (-routerSnakeMod . snakeHeadingRnd , routerSnakeMod . snakeHeadingRnd );
70
+ x += Mathf .cosDeg (heading ) * routerSnakeMod . snakeSegLength ;
71
+ y += Mathf .sinDeg (heading ) * routerSnakeMod . snakeSegLength ;
72
+ if (Mathf .chance (routerSnakeMod . snakeLockOnChc ) && Groups .player .size () > 0 ){
73
73
target = Groups .player .index (Mathf .random (Groups .player .size () - 1 ));
74
- } else if (Mathf .chance (0.008f )){
74
+ }else if (Mathf .chance (routerSnakeMod . snakeLockOffChc )){
75
75
target = null ;
76
76
};
77
- if ((length > 12 || canDecay ) && Mathf .chance (0.0005f * Math .max ((float )length , 10 ))){
77
+ if ((length > routerSnakeMod . minPermSnakeSize || canDecay ) && Mathf .chance (routerSnakeMod . snakeDecayRate * Math .max ((float )length , routerSnakeMod . minPermSnakeSize ))){
78
78
length --;
79
79
segments .remove (0 );
80
80
};
81
- if (target != null && target .unit ().type != null ){
82
- heading = Mathf .slerp (heading , Mathf .angle (target .x - x , target .y - y ), 0.25f );
83
- if (Mathf .len (target .x - x , target .y - y ) < 80f ){
84
- target .unit ().heal ((target .unit ().maxHealth / 1000f + 10f ) * (float )length / 12f );
81
+ if (target != null && ! target .unit ().isNull () ){
82
+ heading = Mathf .slerp (heading , Mathf .angle (target .x - x , target .y - y ), routerSnakeMod . snakeChaseRate );
83
+ if (Mathf .len (target .x - x , target .y - y ) < routerSnakeMod . snakeHealRange ){
84
+ target .unit ().heal ((target .unit ().maxHealth / 10000f + 1f ) * (float )length * routerSnakeMod . snakeUnHealRate );
85
85
};
86
86
};
87
87
segments .each (s -> {
88
88
float segX = s [0 ];
89
89
float segY = s [1 ];
90
- Tile newTile = world .tile (Mathf .floor (segX / 8 ), Mathf .floor (segY / 8 ));
90
+ Tile newTile = world .tile (Mathf .floor (segX / tilesize ), Mathf .floor (segY / tilesize ));
91
91
if (newTile != null && newTile .build != null ){
92
92
Building newBuild = newTile .build ;
93
93
if (newBuild .block != Blocks .distributor ){
94
- newBuild .heal (1f / 100f * newBuild .maxHealth ());
94
+ newBuild .heal (routerSnakeMod . snakeBlHealRate / 100f * newBuild .maxHealth ());
95
95
};
96
96
};
97
97
});
98
- Tile newTile = world .tile (Mathf .floor (x / 8 ), Mathf .floor (y / 8 ));
98
+ Tile newTile = world .tile (Mathf .floor (x / tilesize ), Mathf .floor (y / tilesize ));
99
99
if (newTile != null && newTile .build != null ){
100
100
Building newBuild = newTile .build ;
101
101
if (newBuild .block == Blocks .distributor ){
102
- newBuild .damage (Math .min (40f * (float )length / 12f , 79f ));
103
- x -= Mathf .cosDeg (heading ) * 10f ;
104
- y -= Mathf .sinDeg (heading ) * 10f ;
102
+ newBuild .damage (Math .min (routerSnakeMod . baseDistributorDmg * (float )length / routerSnakeMod . minPermSnakeSize , routerSnakeMod . maxDistributorDmg ));
103
+ x -= Mathf .cosDeg (heading ) * routerSnakeMod . snakeSegLength ;
104
+ y -= Mathf .sinDeg (heading ) * routerSnakeMod . snakeSegLength ;
105
105
heading = Mathf .angle (x - newBuild .x , y - newBuild .y );
106
- if (Mathf .chance (0.02f * length )){
106
+ if (Mathf .chance (routerSnakeMod . distributorGrowChc * length )){
107
107
length ++;
108
108
segments .add (new float []{x , y });
109
109
};
110
- }else if (newBuild .block == Blocks .router && Mathf .chance (( length < 10 && length != 0 ) ? 0.5f / length : 0.05f )){
111
- if (Mathf .chance (0.01f * length )){
110
+ }else if (newBuild .block == Blocks .router && Mathf .chance (routerSnakeMod . baseConsumeChc * Math . max ( routerSnakeMod . minPermSnakeSize / length , 1f ) )){
111
+ if (Mathf .chance (routerSnakeMod . baseSplitChc * length )){
112
112
routerSnakeMod .snakes .add (new routerSnake (x , y , true , length / 2 ));
113
- length = canDecay ? length / 2 : Math .max (length / 2 , 12 );
113
+ length = canDecay ? length / 2 : Math .max (length / 2 , routerSnakeMod . minPermSnakeSize );
114
114
while (segments .size > length ){
115
115
segments .remove (0 );
116
116
};
117
- newBuild .damage (19 );
118
117
}else {
119
118
length ++;
120
119
segments .add (new float []{x , y });
121
- newBuild .damage (19 );
122
120
};
121
+ newBuild .damage (routerSnakeMod .baseRouterDmg );
123
122
};
124
123
};
125
124
i -= 10f ;
0 commit comments