@@ -90,10 +90,17 @@ export const ACTION_DEFINITIONS: Record<schema.Action, typeof Action<ActionUnion
9090 } ,
9191 [ schema . Action . DamageAction ] : class DamageAction extends Action < schema . DamageAction > {
9292 apply ( round : Round ) : void {
93+ const src = round . bodies . getById ( this . robotId )
9394 const target = round . bodies . getById ( this . actionData . id ( ) )
9495
95- // Apply damage to the target
96- target . hp = Math . max ( target . hp - this . actionData . damage ( ) , 0 )
96+ const damage = this . actionData . damage ( )
97+ if ( src . robotType === schema . RobotType . MOPPER ) {
98+ // Apply paint damage to the target
99+ target . paint = Math . max ( target . paint - damage , 0 )
100+ } else {
101+ // Apply HP damage to the target
102+ target . hp = Math . max ( target . hp - damage , 0 )
103+ }
97104 }
98105 } ,
99106 [ schema . Action . SplashAction ] : class SplashAction extends Action < schema . SplashAction > {
@@ -328,30 +335,42 @@ export const ACTION_DEFINITIONS: Record<schema.Action, typeof Action<ActionUnion
328335 } ,
329336 [ schema . Action . TransferAction ] : class TransferAction extends Action < schema . TransferAction > {
330337 apply ( round : Round ) : void {
338+ const amount = this . actionData . amount ( )
339+
340+ if ( amount === 0 ) {
341+ /* ! SCUFFED SPECIAL CASE: Resource pattern completed ! */
342+ return
343+ }
344+
331345 const src = round . bodies . getById ( this . robotId )
332346 const dst = round . bodies . getById ( this . actionData . id ( ) )
333347
334- src . paint -= this . actionData . amount ( )
335- dst . paint += this . actionData . amount ( )
348+ src . paint -= amount
349+ dst . paint += amount
336350 }
337351 draw ( match : Match , ctx : CanvasRenderingContext2D ) : void {
338- const srcBody = match . currentRound . bodies . getById ( this . robotId )
339- const dstBody = match . currentRound . bodies . getById ( this . actionData . id ( ) )
352+ if ( this . actionData . amount ( ) === 0 ) {
353+ /* ! SCUFFED SPECIAL CASE: Resource pattern completed ! */
354+ const centerIdx = this . actionData . id ( )
355+ } else {
356+ const srcBody = match . currentRound . bodies . getById ( this . robotId )
357+ const dstBody = match . currentRound . bodies . getById ( this . actionData . id ( ) )
340358
341- const from = srcBody . getInterpolatedCoords ( match )
342- const to = dstBody . getInterpolatedCoords ( match )
359+ const from = srcBody . getInterpolatedCoords ( match )
360+ const to = dstBody . getInterpolatedCoords ( match )
343361
344- renderUtils . renderLine (
345- ctx ,
346- renderUtils . getRenderCoords ( from . x , from . y , match . currentRound . map . staticMap . dimension ) ,
347- renderUtils . getRenderCoords ( to . x , to . y , match . currentRound . map . staticMap . dimension ) ,
348- {
349- color : '#11fc30' ,
350- lineWidth : 0.06 ,
351- opacity : 0.5 ,
352- renderArrow : true
353- }
354- )
362+ renderUtils . renderLine (
363+ ctx ,
364+ renderUtils . getRenderCoords ( from . x , from . y , match . currentRound . map . staticMap . dimension ) ,
365+ renderUtils . getRenderCoords ( to . x , to . y , match . currentRound . map . staticMap . dimension ) ,
366+ {
367+ color : '#11fc30' ,
368+ lineWidth : 0.06 ,
369+ opacity : 0.5 ,
370+ renderArrow : true
371+ }
372+ )
373+ }
355374 }
356375 } ,
357376 [ schema . Action . MessageAction ] : class MessageAction extends Action < schema . MessageAction > {
0 commit comments