Changeset 7111
- Timestamp:
- 02/25/08 02:26:51 (5 years ago)
- Location:
- lang/d/koke/trunk
- Files:
-
- 4 modified
-
build.bat (modified) (1 diff)
-
character.d (modified) (11 diffs)
-
gamecore.d (modified) (1 diff)
-
resource/image/char.bmp (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
lang/d/koke/trunk/build.bat
r7081 r7111 14 14 :RUN 15 15 koke.exe 16 #make -fMakefile.dmd.win32 obj-clean16 make -fMakefile.dmd.win32 obj-clean 17 17 goto END 18 18 -
lang/d/koke/trunk/character.d
r7081 r7111 168 168 if(motion == MOTION.NORMAL){ 169 169 int t = Hell_randInt(0,100); 170 if(t < configparser.getint("NICOCHU_TURN_RATIO")){ 170 if(t < configparser.getint("NICOCHU_TURN_RATIO")){ // 芝の濃い方に高確率で振り向く 171 171 int gl = cast(int)map.getGrassLevel(x-1,y); 172 172 int gr = cast(int)map.getGrassLevel(x+1,y); … … 211 211 case TYPE.RAINBOW_RAY: 212 212 if(motion == MOTION.NORMAL) setMotion(MOTION.WALK); 213 if( gamemain.map.isMap( getDestX() , getDestY() , MapChip.TYPE.FENCE)){ 214 exist = false; 215 } 213 216 destroyNeighbor(); 214 217 break; … … 237 240 case TYPE.ARASHI: 238 241 if(motion == MOTION.NORMAL){ 239 if(eatMovie()){ 242 if(eatCharacter(TYPE.NICOCHU)){ 243 setMotion(MOTION.EATING2); 244 }else if(eatMovie()){ 240 245 setMotion(MOTION.EATING2); 241 246 }else{ … … 253 258 break; 254 259 } 260 actBreed(); 255 261 actCharacter(); 256 262 } … … 271 277 272 278 // 移動先の確認 273 int x = cast(int)(position.x + vecx[cast(int)direction]); 274 int y = cast(int)(position.y + vecy[cast(int)direction]); 275 if( !gamemain.map.isMovable(x,y) && isBlocking() ){ 279 if( !gamemain.map.isMovable(getDestX() , getDestY()) && isBlocking() ){ 276 280 move_fraction = 0; 277 281 setMotion(MOTION.NORMAL); … … 291 295 t++; 292 296 direction = cast(DIRECTION) Hell_randInt(0,DIRECTION.MAX); 293 int x = cast(int)(position.x + vecx[direction]); 294 int y = cast(int)(position.y + vecy[direction]); 295 chk = gamemain.map.isMovable(x,y); 297 chk = gamemain.map.isMovable(getDestX() , getDestY()); 296 298 }while(!chk && t < 32); 297 299 } … … 338 340 } 339 341 340 // 芝を食うの図 341 bool eatGrass(){ 342 int x = cast(int)position.x , y = cast(int)position.y; 343 344 if(move_fraction != 0) return false; 345 if(gamemain.map.getGrassLevel(x,y) < 1) return false; // レベル1以上の芝しか食べない 346 347 // 芝を食う 348 life += gamemain.map.getGrassLevel(x,y) * 2; 349 if(life >= type_life_max[type]) { 342 // 増える系処理 343 void actBreed(){ 344 if(move_fraction != 0 || motion == MOTION.NORMAL) return false; 345 346 TYPE child_type = TYPE.NONE; 347 switch (type){ 348 // ニコ厨 349 case TYPE.NICOCHU: 350 child_type = TYPE.NICOCHU; 351 // 一定率で"あらし"になる 352 if(Hell_randInt(0,100) < configparser.getint("ARASHI_TRANSFORM_RATIO")){ 353 child_type = TYPE.ARASHI; 354 } 355 break; 356 357 // あらし 358 case TYPE.ARASHI: 359 child_type = TYPE.ARASHI; 360 break; 361 362 default: 363 break; 364 } 365 366 // 実際の増える処理 367 if(child_type != TYPE.NONE && life >= type_life_max[type]) { 350 368 // ライフ上限を超えたらライフを半分にして増殖 351 369 life /= 2; 352 370 353 TYPE ty = TYPE.NICOCHU; 354 // 一定率で"あらし"になる 355 if(Hell_randInt(0,100) < configparser.getint("ARASHI_TRANSFORM_RATIO")){ 356 ty = TYPE.ARASHI; 357 } 358 359 Character c = gamemain.charpool.set( new Vec3(position.x , position.y , 0) , ty); 371 Character c = gamemain.charpool.set( new Vec3(position.x , position.y , 0) , child_type); 360 372 if(c){ 361 373 c.life = life; … … 363 375 c.direction = cast(DIRECTION) Hell_randInt( 0 , DIRECTION.MAX ); 364 376 } 365 366 } 367 } 377 } 378 } 379 } 380 381 // 芝を食うの図 382 bool eatGrass(){ 383 int x = cast(int)position.x , y = cast(int)position.y; 384 385 if(move_fraction != 0) return false; 386 if(gamemain.map.getGrassLevel(x,y) < 1) return false; // レベル1以上の芝しか食べない 387 388 // 芝を食う 389 life += gamemain.map.getGrassLevel(x,y) * 2; 368 390 gamemain.map.setGrass(x,y,0); 369 391 return true; … … 391 413 392 414 return true; 415 } 416 } 417 return false; 418 } 419 420 // キャラを食べる 421 bool eatCharacter(TYPE type , bool all_dir = false){ 422 int x = cast(int)position.x , y = cast(int)position.y; 423 424 if(move_fraction != 0) return false; 425 for(int t = 0 ; t < cast(int)DIRECTION.MAX ; t++){ 426 if(all_dir == false && direction != cast(DIRECTION)t) continue; 427 428 int px = x + cast(int)vecx[t]; 429 int py = y + cast(int)vecy[t]; 430 Character ch[] = gamemain.charpool.getCharacterAtMap(px,py); 431 foreach(inout c;ch){ 432 if(c && c.exist && c.type == type){ 433 // キャラクタを食べる 434 direction = cast(DIRECTION)t; 435 life += c.life; 436 437 c.destroy(); 438 return true; 439 } 393 440 } 394 441 } … … 550 597 } 551 598 599 // マップ表示時の座標 552 600 double toMapXf(){ 553 601 return position.x + move_fraction * vecx[cast(int)direction]; … … 555 603 double toMapYf(){ 556 604 return position.y + move_fraction * vecy[cast(int)direction]; 605 } 606 607 // 移動先XY 608 int getDestX(){ 609 return cast(int)(position.x + vecx[direction]); 610 } 611 int getDestY(){ 612 return cast(int)(position.y + vecy[direction]); 557 613 } 558 614 } -
lang/d/koke/trunk/gamecore.d
r7081 r7111 201 201 // 運営レーザー コマンド 202 202 mray_timer++; 203 if(mray_timer > MRAY_TIMER_SECOND_TARGET ){203 if(mray_timer > MRAY_TIMER_SECOND_TARGET && mray_timer % 3 == 0){ 204 204 shake_power = 16; 205 Character c = charpool.set( new Vec3(cursor_x , cursor_y , 0) , Character.TYPE.EXPLODE); 206 c.destroyMap(cursor_x , cursor_y , Hell_randInt(0,5) , true); // 一次的な対応 207 c.setMotion(Character.MOTION.VANISH); 205 Character c = charpool.set( new Vec3(cursor_x , cursor_y , 0) , Character.TYPE.EXPLODE); /* 一次的な対応 */ 206 if(c){ 207 c.destroyMap(cursor_x , cursor_y , Hell_randInt(0,5) , true); 208 c.setMotion(Character.MOTION.VANISH); 209 } 208 210 } 209 211 break;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)