File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ const FighterProperties = {
105105 HP : "HP" ,
106106 STAMINA : "stamina" ,
107107 SPEED : "speed" ,
108- WEAPON : "bulletsLeft" ,
108+ WEAPON : "weapon?. bulletsLeft" ,
109109} as const ;
110110export const GET_PROPERTY_OF_FIGHTER = "get_property_of_fighter" ;
111111Blockly . Blocks [ GET_PROPERTY_OF_FIGHTER ] = {
@@ -132,8 +132,12 @@ Blockly.JavaScript[GET_PROPERTY_OF_FIGHTER] = (block: Blockly.Block) => [
132132 block ,
133133 OBJECT ,
134134 Blockly . JavaScript . ORDER_MEMBER
135- ) } .${ block . getFieldValue ( PROPERTY_NAME ) } `,
136- Blockly . JavaScript . ORDER_MEMBER ,
135+ ) } .${ block . getFieldValue ( PROPERTY_NAME ) } ? ${ Blockly . JavaScript . valueToCode (
136+ block ,
137+ OBJECT ,
138+ Blockly . JavaScript . ORDER_MEMBER
139+ ) } .${ block . getFieldValue ( PROPERTY_NAME ) } : 0`,
140+ Blockly . JavaScript . ORDER_CONDITIONAL ,
137141] ;
138142
139143// 定数
@@ -571,7 +575,7 @@ Blockly.Blocks[CONSOLE_LOG] = {
571575 this . appendValueInput ( VALUE ) . appendField ( "console.log" ) ;
572576 this . setPreviousStatement ( true ) ;
573577 this . setNextStatement ( true ) ;
574- this . setColour ( 0 ) ;
578+ this . setColour ( 160 ) ;
575579 } ,
576580} ;
577581Blockly . JavaScript [ CONSOLE_LOG ] = ( block : Blockly . Block ) =>
Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ export default function Arena(props: ArenaProps) {
124124 const [ open , setOpen ] = useState ( false ) ;
125125 const [ errorMessage , setErrorMessage ] = useState ( " " ) ;
126126 const [ name , setName ] = useState ( "" ) ;
127+ const [ uploaded , setUploaded ] = useState ( false ) ;
127128 const { password } = useApiPasswordContext ( ) ;
128129 if ( ! password ) throw new Error ( "Missing password" ) ;
129130
@@ -150,6 +151,7 @@ export default function Arena(props: ArenaProps) {
150151 program : newProgram ,
151152 rank : currentUser . rank ,
152153 } ) ;
154+ setUploaded ( true ) ;
153155 } ;
154156
155157 const handleClickOpen = ( ) => {
@@ -281,6 +283,16 @@ export default function Arena(props: ArenaProps) {
281283 name = { name }
282284 setName = { setName }
283285 />
286+ { uploaded && (
287+ < Dialog
288+ open = { uploaded }
289+ onClose = { ( ) => {
290+ setUploaded ( false ) ;
291+ } }
292+ >
293+ < Typography sx = { { px : 2 , py : 1 } } > アップロードしました</ Typography >
294+ </ Dialog >
295+ ) }
284296 </ >
285297 ) ;
286298}
Original file line number Diff line number Diff line change @@ -431,7 +431,7 @@ export default function TestPlay(props: TestPlayProps) {
431431 setSubmitted ( false ) ;
432432 } }
433433 >
434- { currentUser . program }
434+ < Typography sx = { { px : 2 , py : 1 } } > 反映しました </ Typography >
435435 </ Dialog >
436436 ) }
437437 </ >
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