몬스터 벽인식
-출저-노력님
1단계.
MonPos.java
package psjump.server.utils;
import psjump.server.model.*;
public class MonPos{ //마법 벽인식부분!
public static int PossibleMon( int tax, int tay, int chx, int chy, int map){
int _tax;
int _tay;
int arw = 0;
while(arw==0){
if((tax == chx && tay == chy) || (tax+1 == chx && tay-1 == chy) || (tax+1 == chx && tay == chy) || (tax+1 == chx && tay+1 == chy) || (tax == chx && tay+1 == chy) || (tax-1 == chx && tay+1 == chy) || (tax-1 == chx && tay == chy) || (tax-1 == chx && tay-1 == chy) || (tax == chx && tay-1 == chy)){
break;
}else if(tax < chx && tay > chy){
tax++;tay--;
if(0 == WorldMapPoint.getInstance().get_map(tax, tay, map)){
arw=1;_tax=tax;_tay=tay;
break;
}
}else if(tax < chx && tay == chy){
tax++;
if(0 == WorldMapPoint.getInstance().get_map(tax, tay, map)){
arw=1;_tax=tax;_tay=tay;break;
}
}else if(tax < chx && tay < chy){
tax++;tay++;
if(0 == WorldMapPoint.getInstance().get_map(tax, tay, map)){
arw=1;_tax=tax;_tay=tay;break;
}
}else if(tax == chx && tay < chy){
tay++;
if(0 == WorldMapPoint.getInstance().get_map(tax, tay, map)){
arw=1;_tax=tax;_tay=tay;break;
}
}else if(tax > chx && tay < chy){
tax--;tay++;
if(0 == WorldMapPoint.getInstance().get_map(tax, tay, map)){
arw=1;_tax=tax;_tay=tay;break;
}
}else if(tax > chx && tay == chy){
tax--;
if(0 == WorldMapPoint.getInstance().get_map(tax, tay, map)){
arw=1;_tax=tax;_tay=tay;break;
}
}else if(tax > chx && tay > chy){
tax--;tay--;
if(0 == WorldMapPoint.getInstance().get_map(tax, tay, map)){
arw=1;_tax=tax;_tay=tay;break;
}
}else if(tax == chx && tay > chy){
tay--;
if(0 == WorldMapPoint.getInstance().get_map(tax, tay, map)){
arw=1;_tax=tax;_tay=tay;break;
}
}
}
return arw;
}
}
컴파일 하시고 utils 폴더에 넣으세요
2단계
몬스터 AI마다 벽인식을 추가 해 주셔야 됩니다.
서큐버스를 예로 들겠습니다.
서큐버스.java
package psjump.server.utils;
import psjump.server.model.*;
public class 서큐버스 extends 일반몬스터{
public int AI(L1NpcInstance mon, L1Character cha, int type){
int arrset=0; // <--추가
int 브레스 = 1115;
int speed = mon.getNpcTemplate().getmovespeed();
int Dmg = 1;
int MrDmg;
if(mon.get_x() == cha.get_x() && mon.get_y() == cha.get_y())
{
arrset = 0; // CPU 100을 막기위해서.
}
arrset = MonPos.PossibleMon(mon.get_x(),mon.get_y(), cha.get_x(), cha.get_y(), mon.get_map()); // 장애물 검색
if(arrset == 0){ // 장애물이없다면
switch(type){
case 0: // 스펠 공격
if(mon.get_currentMp() >= 50){
Dmg = 60;
MrDmg = (cha.get_baseMr()/300)*Dmg;//유저 마방
if(cha.get_Buff_랜스())
{//아이스랜스 상태이면
Dmg = 0;//데미지 0
}
if(cha.get_Buff_이뮨())
{//이뮨 상태이면
Dmg = Dmg/2;//데미지 1/2
}
if(cha.get_Buff_앱솔루트())
{//엡솔루트 상태이면
Dmg = 0;//데미지 0
}
if(cha.get_Buff_어스바인드())
{//어바 상태이면
Dmg = 0;//데미지 0
}
if(cha.get_Buff_포그())
{//포그 상태이면
Dmg = 0;//데미지 0
}
speed = 1440;
mon.AllsendPackets(mon.bph().get_AttackPacket().S_MagicAttackPacket(mon, cha, Dmg, 브레스), true);
cha.set_currentHp(cha.get_currentHp()-(Dmg-MrDmg));
}
break;
case 1: // 일반 공격
speed = Normal(mon, cha);
break;
}
}// 추가
return speed;
}
}

김닉넴 님의 최근 댓글
클라는 있나요? 2023 04.29 클라 있나요? 2023 03.23 감사합니다 2016 06.06 ㄳ합니다 2016 06.05 ㄳ합니다 2016 06.05