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


Java Human.getDamage方法代码示例

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


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

示例1: isValidHuman

import rescuecore2.standard.entities.Human; //导入方法依赖的package包/类
private boolean isValidHuman(StandardEntity entity) {
	if (entity == null)
		return false;
	if (!(entity instanceof Human))
		return false;

	Human target = (Human) entity;
	if (!target.isHPDefined() || target.getHP() == 0)
		return false;
	if (!target.isPositionDefined())
		return false;
	if (!target.isDamageDefined() || target.getDamage() == 0)
		return false;
	if (!target.isBuriednessDefined())
		return false;

	StandardEntity position = worldInfo.getPosition(target);
	if (position == null)
		return false;

	StandardEntityURN positionURN = position.getStandardURN();
	if (positionURN == REFUGE || positionURN == AMBULANCE_TEAM)
		return false;

	return true;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:27,代码来源:TestHumanDetector.java

示例2: MessageHuman

import rescuecore2.standard.entities.Human; //导入方法依赖的package包/类
public MessageHuman(int messageID, Human human)
{
	super(messageID);
	humanID = human.getID();
	humanHP = human.getHP();
	humanBuriedness = human.getBuriedness();
	humanDamage = human.getDamage();
	humanPosition = human.getPosition();
}
 
开发者ID:AIT-Rescue,项目名称:AIT-Rescue,代码行数:10,代码来源:MessageHuman.java

示例3: isCommandCompleted

import rescuecore2.standard.entities.Human; //导入方法依赖的package包/类
private boolean isCommandCompleted() {
    Human agent = (Human) this.agentInfo.me();
    switch (this.type) {
        case ACTION_REST:
            if(this.target == null) {
                return (agent.getDamage() == 0);
            }
            if (Objects.requireNonNull(this.worldInfo.getEntity(this.target)).getStandardURN() == REFUGE) {
                if (agent.getPosition().getValue() == this.target.getValue()) {
                    return (agent.getDamage() == 0);
                }
            }
            return false;
        case ACTION_MOVE:
            return this.target == null || this.agentInfo.getPosition().getValue() == this.target.getValue();
        case ACTION_RESCUE:
            if(this.target == null) {
                return true;
            }
            Human human = (Human) Objects.requireNonNull(this.worldInfo.getEntity(this.target));
            return human.isBuriednessDefined() && human.getBuriedness() == 0 || (human.isHPDefined() && human.getHP() == 0);
        case ACTION_LOAD:
            if(this.target == null) {
                return true;
            }
            Human human1 = (Human) Objects.requireNonNull(this.worldInfo.getEntity(this.target));
            if((human1.isHPDefined() && human1.getHP() == 0)) {
                return true;
            }
            if(human1.getStandardURN() != CIVILIAN) {
                this.type = ACTION_RESCUE;
                return this.isCommandCompleted();
            }
            if (human1.isPositionDefined()) {
                EntityID position = human1.getPosition();
                if (this.worldInfo.getEntityIDsOfType(AMBULANCE_TEAM).contains(position)) {
                    return true;
                } else if (this.worldInfo.getEntity(position).getStandardURN() == REFUGE) {
                    return true;
                }
            }
            return false;
        case ACTION_UNLOAD:
            if(this.target != null) {
                StandardEntity entity = this.worldInfo.getEntity(this.target);
                if (entity != null && entity instanceof Area) {
                    if (this.target.getValue() != this.agentInfo.getPosition().getValue()) {
                        return false;
                    }
                }
            }
            return (this.agentInfo.someoneOnBoard() == null);
        case ACTION_AUTONOMY:
            if(this.target != null) {
                StandardEntity targetEntity = this.worldInfo.getEntity(this.target);
                if (targetEntity instanceof Area) {
                    this.type = this.agentInfo.someoneOnBoard() == null ? ACTION_MOVE : ACTION_UNLOAD;
                    return this.isCommandCompleted();
                }else if (targetEntity instanceof Human) {
                    Human h = (Human) targetEntity;
                    if((h.isHPDefined() && h.getHP() == 0)) {
                        return true;
                    }
                    this.type = h.getStandardURN() == CIVILIAN ? ACTION_LOAD : ACTION_RESCUE;
                    return this.isCommandCompleted();
                }
            }
            return true;
    }
    return true;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:72,代码来源:CommandExecutorAmbulance.java


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