Commit 21b1d7f
authored
fix: last projectile spell casting (AscensionGameDev#2174)
* fix: last projectile spell casting:
This commit addresses a bug where a spell with ammunition requirements would consume the last projectile without actually casting it out. It is also intended to provide additional chore changes and move player related code out to it's own overrides. Files changed:
1. Entity.cs - Moved projectile removal to player's CastSpell override method. Also moved the player's specific handlers for spell's cooldown to player's CastSpell override method.
2. Player.cs - Removed redundant and repeated code within the UseSpell method (ie. CastSpell(..) is already called within Entity's Update method when required) and added projectile removal and cooldown handlers within the CastSpell override method.
* day's review: polymorphism:
As suggested by review, applies polymorphism to handle the cooldown update.
We now have a virtual method in the Entity class that is overridden in the Player class.
This way, we avoid type checking and let the correct method be called based on the object's type.
* chore: ConsumeSpellProjectile:
refactors the player logic to consume spell projectiles as the ConsumeSpellProjectile method1 parent 0886191 commit 21b1d7f
2 files changed
+64
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
380 | 394 | | |
381 | 395 | | |
382 | 396 | | |
| |||
2477 | 2491 | | |
2478 | 2492 | | |
2479 | 2493 | | |
2480 | | - | |
2481 | | - | |
2482 | | - | |
2483 | | - | |
2484 | | - | |
2485 | | - | |
2486 | | - | |
2487 | | - | |
2488 | | - | |
2489 | | - | |
2490 | | - | |
2491 | | - | |
2492 | | - | |
2493 | | - | |
2494 | | - | |
2495 | | - | |
2496 | | - | |
2497 | | - | |
2498 | | - | |
| 2494 | + | |
2499 | 2495 | | |
2500 | 2496 | | |
2501 | 2497 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
891 | 891 | | |
892 | 892 | | |
893 | 893 | | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
894 | 914 | | |
895 | 915 | | |
896 | 916 | | |
| |||
5419 | 5439 | | |
5420 | 5440 | | |
5421 | 5441 | | |
5422 | | - | |
5423 | 5442 | | |
5424 | 5443 | | |
5425 | 5444 | | |
| |||
5439 | 5458 | | |
5440 | 5459 | | |
5441 | 5460 | | |
5442 | | - | |
5443 | | - | |
5444 | | - | |
5445 | | - | |
5446 | | - | |
5447 | | - | |
5448 | | - | |
5449 | | - | |
5450 | | - | |
5451 | | - | |
5452 | | - | |
5453 | | - | |
5454 | 5461 | | |
5455 | 5462 | | |
5456 | 5463 | | |
5457 | 5464 | | |
5458 | 5465 | | |
5459 | 5466 | | |
5460 | 5467 | | |
5461 | | - | |
5462 | | - | |
5463 | | - | |
5464 | | - | |
5465 | | - | |
5466 | | - | |
5467 | | - | |
5468 | | - | |
5469 | | - | |
| 5468 | + | |
| 5469 | + | |
5470 | 5470 | | |
5471 | | - | |
5472 | 5471 | | |
5473 | 5472 | | |
5474 | 5473 | | |
| |||
5484 | 5483 | | |
5485 | 5484 | | |
5486 | 5485 | | |
5487 | | - | |
| 5486 | + | |
5488 | 5487 | | |
5489 | 5488 | | |
5490 | 5489 | | |
| |||
5506 | 5505 | | |
5507 | 5506 | | |
5508 | 5507 | | |
| 5508 | + | |
| 5509 | + | |
| 5510 | + | |
| 5511 | + | |
| 5512 | + | |
| 5513 | + | |
| 5514 | + | |
| 5515 | + | |
| 5516 | + | |
| 5517 | + | |
| 5518 | + | |
| 5519 | + | |
| 5520 | + | |
| 5521 | + | |
| 5522 | + | |
| 5523 | + | |
| 5524 | + | |
| 5525 | + | |
| 5526 | + | |
| 5527 | + | |
| 5528 | + | |
| 5529 | + | |
| 5530 | + | |
| 5531 | + | |
| 5532 | + | |
| 5533 | + | |
5509 | 5534 | | |
5510 | 5535 | | |
5511 | 5536 | | |
| |||
0 commit comments