Skip to content

Commit 976cab8

Browse files
committed
trail count & colorize
1 parent 7c67042 commit 976cab8

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

assets/dbs/abilities_animations/ray_db.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@
1212
"pos": {"x": "targets", "y": "targets"},
1313
"range_delta": {"x": 25}
1414
},
15-
"count": 15,
16-
"duration": 600,
17-
"interval_time": 100,
18-
"trail_factor": 0.1,
15+
"count": 17,
16+
"duration": 200,
17+
"interval_time": 50,
18+
"trail_factor": 0.05,
1919
"trail": true,
20+
"trail_count": 4,
21+
"trail_colorize": {
22+
"color": 0.15,
23+
"intensity": 1
24+
},
2025
"glow": {
21-
"distance": 5,
26+
"distance": 7,
2227
"r": 0.91,
2328
"g": 0.25,
2429
"b": 0.94,
25-
"strength": 0.1
30+
"strength": 0.6
2631
}
2732
}],
2833
"particles_sequence": [{

base/battle/BattleAnimation.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@ export class BattleAnimation {
318318
ignore_if_dodge?: boolean;
319319
trail: boolean;
320320
trail_factor: number;
321+
trail_count: number;
322+
trail_colorize: {
323+
color: number;
324+
intensity: number;
325+
};
321326
duration: number;
322327
}[] = [];
323328
public particles_sequence: ParticlesInfo;
@@ -1362,6 +1367,8 @@ export class BattleAnimation {
13621367
const count = lighting_seq.count ?? 1;
13631368
const trail = lighting_seq.trail ?? true;
13641369
const trail_factor = lighting_seq.trail_factor ?? 0.5;
1370+
const trail_count = lighting_seq.trail_count ?? -1;
1371+
const trail_colorize = lighting_seq.trail_colorize ?? null;
13651372
const duration = _.clamp(lighting_seq.duration, 30, Infinity);
13661373
for (let j = 0; j < count; ++j) {
13671374
let resolve_function;
@@ -1433,8 +1440,17 @@ export class BattleAnimation {
14331440
this.trails_objs.push(trail_image);
14341441
this.ability_sprites_groups[group_pos].addChild(trail_image);
14351442
img.data.trail_image = trail_image;
1443+
img.data.trail_count = trail_count;
1444+
img.data.trail_applied = 0;
14361445
img.data.trail_enabled = true;
14371446
img.data.render_texture = this.game.make.renderTexture(img.width, img.height);
1447+
1448+
if (trail_colorize) {
1449+
const colorize_filter = this.game.add.filter("Colorize") as Phaser.Filter.Colorize;
1450+
colorize_filter.color = trail_colorize.color;
1451+
colorize_filter.intensity = trail_colorize.intensity;
1452+
trail_image.filters = [colorize_filter];
1453+
}
14381454
}
14391455

14401456
const y_data = cumsum(random_normal(data_size, lighting_seq.roughness ?? 0.01, 0));
@@ -1982,6 +1998,12 @@ export class BattleAnimation {
19821998
if (sprite.data.keep_core_white) {
19831999
sprite.tint = sprite.data.color;
19842000
}
2001+
if (sprite.data.trail_count > 0) {
2002+
if (sprite.data.trail_applied > sprite.data.trail_count) {
2003+
return;
2004+
}
2005+
++sprite.data.trail_applied;
2006+
}
19852007
if (sprite.data.render_texture) {
19862008
sprite.data.render_texture.renderXY(sprite, 0, 0);
19872009
bm_data.draw(sprite.data.render_texture);

0 commit comments

Comments
 (0)