Dev: TARGETED and TARGET events must be refactored to support objectId data
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 940
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 160
Description
Current `GameEvent.EventType.TARGETED` game event lost information about source of the event -- it contains only `sourceId` (e.g. id of the targeting card). But it doesn't contains `objectId` information (e.g. real object id that called the target).
Use case: if you need to find a stack object but the stack contains multiple objects from the same card (bug example and workaround: #8394). It's ok in most use cases cause you need to check the controller only, but it's potentially buggy on stack object usage.
TODO:
* [ ] Add `TargetedEvent` class for `TARGETED` event (example: `ManaPaidEvent`). It must contains `Ability source` and `UUID objectId` params and updated docs (`TARGETED` event must have objectId description too). You can't store `objectId` data in the `sourceId` field due #7242.
* [ ] Replace all `getEvent(GameEvent.EventType.TARGETED` by new `TargetedEvent` with additional param `objectId`.
* [ ] It require to modify all `void addTarget(UUID id...` Target's methods by additional `objectId` param (there are ~100 calls of the methods):
* calls from effects or game engine must pass `source.getSourceId()` to `objectId` param;
* calls from stack objects must pass an own id;
* [ ] ? Maybe `TARGET` event must be refactored same way?
P.S. Another potentially refactored events or places can be found by:
* `= game.getStack().getStackObject(event.getSourceId());`
Good usage (controller info will be same for all source's objects):

Bad usage (you need stack object id for the effect):

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.