diff --git a/data/sprites/entity/overlay/transform.png b/data/sprites/entity/overlay/transform.png new file mode 100644 index 0000000000..0bbcd5b922 Binary files /dev/null and b/data/sprites/entity/overlay/transform.png differ diff --git a/doc/CHANGES.txt b/doc/CHANGES.txt index 51038ffae4..fdcfb90edc 100644 --- a/doc/CHANGES.txt +++ b/doc/CHANGES.txt @@ -19,6 +19,7 @@ Changelog - added parallax backgrounds to Wizards Tower - added quick menu button to toggle pathfinding via ground - added support for animated entity overlay effects +- added transformation effect to vampires 1.47 diff --git a/doc/contributors.md b/doc/contributors.md index 7b3403a5d4..2762d9dbcc 100644 --- a/doc/contributors.md +++ b/doc/contributors.md @@ -998,6 +998,7 @@ The following people released their work to the public with a suitable license f * [Inchadney](http://inchadney.com/sounds.html) * [Bart Kelsey](https://opengameart.org/users/bart) * [David Kvistorf (fluffclipse)](https://soundcloud.com/david-kvistorf) +* [Aidan Walker](https://opengameart.org/users/aidanwalker) diff --git a/doc/contributors/contributors.json b/doc/contributors/contributors.json index 3e90c4f83c..3d9e51f2bc 100644 --- a/doc/contributors/contributors.json +++ b/doc/contributors/contributors.json @@ -4773,6 +4773,10 @@ "fullname": "David Kvistorf", "link": "https://soundcloud.com/david-kvistorf", "link_alt": "https://opengameart.org/users/fluffclipse" + }, + { + "name": "Aidan Walker", + "link": "https://opengameart.org/users/aidanwalker" } ] } diff --git a/doc/sources/graphics-entity.txt b/doc/sources/graphics-entity.txt index 3e2e3eb8d2..5ef5a337da 100644 --- a/doc/sources/graphics-entity.txt +++ b/doc/sources/graphics-entity.txt @@ -773,6 +773,7 @@ flame* DkuCook, Jordan Irwin (AntumDeluge); CC0; https://opengameart.or ice_sparkles* Jordan Irwin (AntumDeluge); OGA BY 3.0 or newer; Stendhal magic_sparkles Rawdanitsu, olonu; CC0; https://opengameart.org/node/18068 necro_flames Wolf W. (Ouren), Jordan Irwin (AntumDeluge); CC BY 3.0; https://opengameart.org/node/45981 +transform Aidan Walker; CC0; https://opengameart.org/node/160840 data/sprites/entity/ratfolk/ diff --git a/src/js/stendhal/entity/Creature.ts b/src/js/stendhal/entity/Creature.ts index 28ac435dcc..7b58ebfbe3 100644 --- a/src/js/stendhal/entity/Creature.ts +++ b/src/js/stendhal/entity/Creature.ts @@ -15,6 +15,8 @@ import { EntityOverlayRegistry } from "../data/EntityOverlayRegistry"; import { Color } from "../data/color/Color"; +import { SkillEffect } from "../sprite/action/SkillEffect"; + declare var marauroa: any; declare var stendhal: any; @@ -53,4 +55,17 @@ export class Creature extends RPEntity { return "url(" + stendhal.paths.sprites + "/cursor/attack.png) 1 3, auto"; } + /** + * Shows a temporary animation overlay for certain entities. + * + * FIXME: does not restore previous overlay + */ + protected override onTransformed() { + if (!this["name"].startsWith("vampire")) { + return; + } + const delay = 100; + const frames = 5; + this.overlay = new SkillEffect("transform", delay, delay * frames); + } } diff --git a/src/js/stendhal/entity/RPEntity.ts b/src/js/stendhal/entity/RPEntity.ts index c131aff7bb..8d33d0a4a0 100644 --- a/src/js/stendhal/entity/RPEntity.ts +++ b/src/js/stendhal/entity/RPEntity.ts @@ -102,6 +102,8 @@ export class RPEntity extends ActiveEntity { this.onLevelChanged(key, value, oldValue); } else if (["title", "name", "class", "type"].indexOf(key) >-1) { this.createTitleTextSprite(); + } else if (key === "subclass" && typeof(oldValue) !== "undefined" && value !== oldValue) { + this.onTransformed(); } } @@ -848,4 +850,13 @@ export class RPEntity extends ActiveEntity { this._target.onAttackStopped(this); } } + + /** + * Called when entity's subclass is changed. + * + * Does nothing in this implementation. + */ + protected onTransformed() { + // do nothing + } }