테스트

aion-server 4.8

Gitteol
최고관리자 · 1 · 💬 0 클론/새로받기
 4.8 61f661d · 1 commits 새로받기(Pull)
game-server/src/com/aionemu/gameserver/skillengine/properties/Properties.java
package com.aionemu.gameserver.skillengine.properties;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;

import com.aionemu.gameserver.model.gameobjects.Creature;
import com.aionemu.gameserver.skillengine.effect.AbnormalState;
import com.aionemu.gameserver.skillengine.model.Skill;
import com.aionemu.gameserver.skillengine.model.SkillTemplate;

/**
 * @author ATracer
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Properties")
public class Properties {

	@XmlAttribute(name = "first_target", required = true)
	protected FirstTargetAttribute firstTarget;

	@XmlAttribute(name = "first_target_range")
	protected int firstTargetRange;

	@XmlAttribute(name = "awr")
	protected boolean addWeaponRange;

	@XmlAttribute(name = "target_relation")
	protected TargetRelationAttribute targetRelation;

	@XmlAttribute(name = "target_type")
	protected TargetRangeAttribute targetType;

	@XmlAttribute(name = "target_distance")
	protected int targetDistance;

	@XmlAttribute(name = "target_maxcount")
	protected int targetMaxCount;

	@XmlAttribute(name = "target_status")
	private List<AbnormalState> targetStatus;

	@XmlAttribute(name = "revision_distance")
	protected int revisionDistance;

	@XmlAttribute(name = "effective_range")
	private int effectiveRange;

	@XmlAttribute(name = "effective_altitude")
	private int effectiveAltitude;

	@XmlAttribute(name = "effective_angle")
	private int effectiveAngle;

	@XmlAttribute(name = "effective_dist")
	private int effectiveDist;

	@XmlAttribute(name = "direction")
	protected AreaDirections direction = AreaDirections.NONE;

	@XmlAttribute(name = "target_species")
	protected TargetSpeciesAttribute targetSpecies;

	@XmlAttribute(name = "ineffective_range")
	protected int ineffectiveRange;

	public boolean validate(Skill skill, CastState castState) {
		if (firstTarget != null) {
			if (!FirstTargetProperty.set(skill, this)) {
				return false;
			}
		}
		if (firstTargetRange != 0 || addWeaponRange) {
			if (!FirstTargetRangeProperty.set(skill, this, castState)) {
				return false;
			}
		}
		return validateEffectedList(skill);
	}

	public boolean endCastValidate(Skill skill) {
		Creature firstTarget = skill.getFirstTarget();
		skill.getEffectedList().clear();
		skill.getEffectedList().add(firstTarget);

		if (firstTargetRange != 0) {
			if (!FirstTargetRangeProperty.set(skill, this, CastState.CAST_END)) {
				return false;
			}
		}
		return validateEffectedList(skill);
	}

	private boolean validateEffectedList(Skill skill) {
		ValidationResult result = validateEffectedList(skill.getEffectedList(), skill.getFirstTarget(), skill.getEffector(), skill.getSkillTemplate(), skill.getX(), skill.getY(), skill.getZ());
		skill.setFirstTarget(result.getFirstTarget());
		return result.isValid();
	}

	public ValidationResult validateEffectedList(List<Creature> targets, Creature firstTarget, Creature effector, SkillTemplate skillTemplate, float x,
		float y, float z) {
		ValidationResult result = new ValidationResult(targets, firstTarget);
		if (targetType != null && !TargetRangeProperty.set(this, result, effector, skillTemplate, x, y, z))
			return result;
		if (targetRelation != null && !TargetRelationProperty.set(this, result, effector, skillTemplate))
			return result;
		if (targetStatus != null && !TargetStatusProperty.set(this, result, skillTemplate))
			return result;
		if (targetSpecies != null && !TargetSpeciesProperty.set(this, result))
			return result;
		if (targetType != null && !MaxCountProperty.set(this, result))
			return result;
		result.valid = true;
		return result;
	}

	public FirstTargetAttribute getFirstTarget() {
		return firstTarget;
	}

	public int getFirstTargetRange() {
		return firstTargetRange;
	}

	public boolean isAddWeaponRange() {
		return addWeaponRange;
	}

	public TargetRelationAttribute getTargetRelation() {
		return targetRelation;
	}

	public TargetRangeAttribute getTargetType() {
		return targetType;
	}

	public int getTargetDistance() {
		return targetDistance;
	}

	public int getTargetMaxCount() {
		return targetMaxCount;
	}

	public List<AbnormalState> getTargetStatus() {
		return targetStatus;
	}

	public int getRevisionDistance() {
		return revisionDistance;
	}

	public int getEffectiveRange() {
		return effectiveRange;
	}

	public int getEffectiveAltitude() {
		return effectiveAltitude;
	}

	public int getEffectiveDist() {
		return effectiveDist;
	}

	public int getEffectiveAngle() {
		return effectiveAngle;
	}

	public AreaDirections getDirection() {
		return direction;
	}

	public TargetSpeciesAttribute getTargetSpecies() {
		return targetSpecies;
	}

	public enum CastState {
		CAST_START,
		CAST_END;
	}

	public int getIneffectiveRange() {
		return ineffectiveRange;
	}

	public static class ValidationResult {

		private final List<Creature> targets;
		private Creature firstTarget;
		private boolean valid;

		public ValidationResult(List<Creature> targets, Creature firstTarget) {
			this.targets = targets;
			this.firstTarget = firstTarget;
		}

		public List<Creature> getTargets() {
			return targets;
		}

		public Creature getFirstTarget() {
			return firstTarget;
		}

		public void setFirstTarget(Creature firstTarget) {
			this.firstTarget = firstTarget;
		}

		public boolean isValid() {
			return valid;
		}
	}
}

📎 첨부파일

댓글 작성 권한이 없습니다.
🏆 포인트 랭킹 TOP 10
순위 닉네임 포인트
1 no_profile 타키야겐지쪽지보내기 자기소개 아이디로 검색 전체게시물 102,949
2 no_profile 동가리쪽지보내기 자기소개 아이디로 검색 전체게시물 63,733
3 no_profile 라프텔쪽지보내기 자기소개 아이디로 검색 전체게시물 51,771
4 no_profile 불멸의행복쪽지보내기 자기소개 아이디로 검색 전체게시물 36,923
5 서번트쪽지보내기 자기소개 아이디로 검색 전체게시물 35,011
6 no_profile 닥터스쪽지보내기 자기소개 아이디로 검색 전체게시물 29,470
7 no_profile 검은고양이쪽지보내기 자기소개 아이디로 검색 전체게시물 29,077
8 no_profile Revolution쪽지보내기 자기소개 아이디로 검색 전체게시물 28,199
9 no_profile 보거스쪽지보내기 자기소개 아이디로 검색 전체게시물 26,731
10 no_profile 호롤롤로쪽지보내기 자기소개 아이디로 검색 전체게시물 17,020
알림 0