Changeset 7111

Show
Ignore:
Timestamp:
02/25/08 02:26:51 (5 years ago)
Author:
omega
Message:

あらしがニコ厨を食べるようにした。

Location:
lang/d/koke/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/d/koke/trunk/build.bat

    r7081 r7111  
    1414:RUN 
    1515koke.exe 
    16 #make -fMakefile.dmd.win32 obj-clean 
     16make -fMakefile.dmd.win32 obj-clean 
    1717goto END 
    1818 
  • lang/d/koke/trunk/character.d

    r7081 r7111  
    168168                                if(motion == MOTION.NORMAL){ 
    169169                                        int t = Hell_randInt(0,100); 
    170                                         if(t < configparser.getint("NICOCHU_TURN_RATIO")){ 
     170                                        if(t < configparser.getint("NICOCHU_TURN_RATIO")){      // 芝の濃い方に高確率で振り向く 
    171171                                                int gl = cast(int)map.getGrassLevel(x-1,y); 
    172172                                                int gr = cast(int)map.getGrassLevel(x+1,y); 
     
    211211                        case TYPE.RAINBOW_RAY: 
    212212                                if(motion == MOTION.NORMAL) setMotion(MOTION.WALK); 
     213                                if( gamemain.map.isMap( getDestX() , getDestY() , MapChip.TYPE.FENCE)){ 
     214                                        exist = false; 
     215                                } 
    213216                                destroyNeighbor(); 
    214217                                break; 
     
    237240                        case TYPE.ARASHI: 
    238241                                if(motion == MOTION.NORMAL){ 
    239                                         if(eatMovie()){ 
     242                                        if(eatCharacter(TYPE.NICOCHU)){ 
     243                                                setMotion(MOTION.EATING2); 
     244                                        }else if(eatMovie()){ 
    240245                                                setMotion(MOTION.EATING2); 
    241246                                        }else{ 
     
    253258                                break; 
    254259                } 
     260                actBreed(); 
    255261                actCharacter(); 
    256262        } 
     
    271277                         
    272278                        // 移動先の確認 
    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() ){ 
    276280                                move_fraction = 0; 
    277281                                setMotion(MOTION.NORMAL); 
     
    291295                        t++; 
    292296                        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()); 
    296298                }while(!chk && t < 32); 
    297299        } 
     
    338340        } 
    339341         
    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]) { 
    350368                        // ライフ上限を超えたらライフを半分にして増殖 
    351369                        life /= 2; 
    352370                         
    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); 
    360372                        if(c){ 
    361373                                c.life = life; 
     
    363375                                        c.direction = cast(DIRECTION) Hell_randInt( 0 , DIRECTION.MAX ); 
    364376                                } 
    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; 
    368390                gamemain.map.setGrass(x,y,0); 
    369391                return true; 
     
    391413                                 
    392414                                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                                } 
    393440                        } 
    394441                } 
     
    550597        } 
    551598         
     599        // マップ表示時の座標 
    552600        double toMapXf(){ 
    553601                return position.x + move_fraction * vecx[cast(int)direction]; 
     
    555603        double toMapYf(){ 
    556604                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]); 
    557613        } 
    558614} 
  • lang/d/koke/trunk/gamecore.d

    r7081 r7111  
    201201                                // 運営レーザー コマンド 
    202202                                mray_timer++; 
    203                                 if(mray_timer > MRAY_TIMER_SECOND_TARGET){ 
     203                                if(mray_timer > MRAY_TIMER_SECOND_TARGET && mray_timer % 3 == 0){ 
    204204                                        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                                        } 
    208210                                } 
    209211                                break;