File tree Expand file tree Collapse file tree
packages/web/src/component Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -449,11 +449,17 @@ class PunchAction implements FighterAction {
449449
450450 isCompleted = false ;
451451
452+ isSucceeded = false ;
453+
452454 requiredStamina = 20 ;
453455
454456 constructor ( actor : Fighter , target : Fighter ) {
455457 this . actor = actor ;
456458 this . target = target ;
459+ const distance = calculateDistance ( this . actor , this . target ) ;
460+ if ( distance <= Fighter . armLength ) {
461+ this . isSucceeded = true ;
462+ }
457463 }
458464
459465 tick ( ) {
@@ -876,7 +882,7 @@ class WorldRenderer {
876882 if ( action instanceof PunchAction ) {
877883 const existingRenderer = this . punchEffectRenderers . get ( action ) ;
878884 if ( ! existingRenderer ) {
879- if ( ! action . isCompleted ) {
885+ if ( ! action . isCompleted && action . isSucceeded ) {
880886 const newRenderer = new PunchEffectRenderer ( action , this . #pixi) ;
881887 this . punchEffectRenderers . set ( action , newRenderer ) ;
882888 newRenderer . onCompleted = ( ) => {
You can’t perform that action at this time.
0 commit comments