当前位置: 首页>>代码示例>>C++>>正文


C++ Skill::geteHPv方法代码示例

本文整理汇总了C++中Skill::geteHPv方法的典型用法代码示例。如果您正苦于以下问题:C++ Skill::geteHPv方法的具体用法?C++ Skill::geteHPv怎么用?C++ Skill::geteHPv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skill的用法示例。


在下文中一共展示了Skill::geteHPv方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: hDoEvent

int Battle::hDoEvent(){
    if(processStat == prePlayer){
        if((*team)[team->getNameList()[_currentChara]].isDead())
            processStat = PostPlayer;
        else
            processStat = BattleMenu;
    }else if(processStat == PlayerSkill){
        Skill tmp = (*team)[team->getNameList()[_currentChara]].getSkillList()[varMap["SkillMenuCurPos"].get<unsigned int>()];
        if(tmp.getfTarget() == 0){
            engine->engineCall(loadStack(svc::loadTeamMenu, 1));
            engine->engineCall(loadStack(svc::setStat, Stats::inTeamMenu));
            if(varMap["TeamMenuCurPos"].get<unsigned int>() == 0xffffffff){
                processStat = process::BattleMenu;
                return -1;
            }
        }
        int p = engine->engineCall(loadStack(svc::useSkill, _currentChara, varMap["SkillMenuCurPos"].get<unsigned int>(), MonsterMenuCurrentPos, varMap["TeamMenuCurPos"].get<unsigned int>())).get<int>();
        if(!p){
            engine->engineCall(loadStack(svc::loadPrompt, UTF8_to_WChar("Not Enough Mana!"), UTF8_to_WChar("System")));
            processStat = BattleMenu;
        }else{
           processStat = PostPlayer;
    
        }
    }else if(processStat == PostPlayer){
        if(isMonsterWipeOut()){
            processStat = process::PostBattle;
        }else{
             _currentChara++;
            if(_currentChara >= _memberCount){
                engine->engineCall(loadStack(svc::loadPrompt, UTF8_to_WChar("It's Now Monster's Turn"), UTF8_to_WChar("System")));
                processStat = process::MonsterTurn;
            }else{
                processStat = process::prePlayer;
            }
        }
    }else if(processStat == MonsterTurn){
        for(unsigned int i = 0; i < _monsters.size(); i++){

            if(_monsters[i].isDead())
                continue;
            int us = rand() % _monsters[i].getSkillList().size() + 1;

            if(us == 0){//Normal Attack
                int target = rand() % _memberCount;
                float rng = (rand() % 6) / 10 + 0.75;

                int tardef = (*team)[team->getNameList()[target]].getDefense();
                engine->engineCall(loadStack(svc::varHP, target, ((-1) * (rng) * _monsters[i].getAttack() + tardef + charaDefenseBuff[target])));

            }else{//Skills
                Skill tmp = _monsters[i].getSkillList()[us - 1];

                if(tmp.getfTarget() == 0){
                    _monsters[i].varHP(tmp.getfHPv());
                    _monsters[i].varMP(tmp.getfMPv());
                }else if(tmp.getfTarget() == 1){
                    for(unsigned int m = 0; m < _monsters.size(); m++){
                        _monsters[m].varHP(tmp.getfHPv());
                        _monsters[m].varMP(tmp.getfMPv());
                    }
                }

                if(tmp.geteTarget() == 0){
                    unsigned int target = rand() %  _memberCount;
                    engine->engineCall(loadStack(svc::varHP, target, tmp.geteHPv()));
                    engine->engineCall(loadStack(svc::varMP, target, tmp.geteMPv()));
                }else if(tmp.geteTarget() == 1){
                    for(unsigned int m = 0; m < _memberCount; m++){
                        engine->engineCall(loadStack(svc::varHP, m, tmp.geteHPv()));
                        engine->engineCall(loadStack(svc::varMP, m, tmp.geteMPv()));
                    }
                }
            }
            usleep(1000000);
        }

        if(engine->engineCall(loadStack(svc::isTeamWipeOut)).get<int>()){
            engine->engineCall(loadStack(svc::gameOver));
        }else{
            engine->engineCall(loadStack(svc::loadPrompt, UTF8_to_WChar("It's Now your Turn"), UTF8_to_WChar("System")));
            _currentChara = 0;
            processStat = process::prePlayer;
        }
    }else if(processStat == process::PostBattle){
        for(unsigned int i = 0; i < _monstersBak.size(); i++){
            for(unsigned int j = 0; j < _memberCount; j++){
                engine->engineCall(loadStack(svc::varExp, j, _monstersBak[i].getExp())).get<int>();
            }
        }
        engine->engineCall(loadStack(svc::restoreStat));
    }
    return 0;
}
开发者ID:BeyondCloud,项目名称:RPG,代码行数:94,代码来源:battle.cpp


注:本文中的Skill::geteHPv方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。