// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 7/9/2013 11:14:59 AM // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: PlayerModel.java package ga2.stage; import ga2.client.GetAmped2; import ga2.data.*; import ga2.data.net.GameRoomInfo; import ga2.setting.GameSetting; import ga2.stage.ai.AiController; import ga2.stage.atk.AttackParam; import ga2.stage.atk.BasicAttack; import ga2.stage.atk.GuardParam; import ga2.stage.atk.ShootAttack; import ga2.stage.atk.StageItem; import ga2.stage.event.AmpedEvent; import ga2.stage.event.AmpedProperty; import ga2.stage.event.BasicAmpedEvent; import ga2.stage.event.DropStageItemEvent; import ga2.stage.event.ItemActionEvent; import ga2.stage.event.ItemScriptEvent; import ga2.stage.event.PlayerActionEvent; import ga2.stage.event.PlayerAttackEvent; import ga2.stage.event.PlayerAttackHitEvent; import ga2.stage.event.PlayerAttackedEvent; import ga2.stage.event.PlayerEmotionEvent; import ga2.stage.event.PlayerEvent; import ga2.stage.event.PlayerRingoutEvent; import ga2.stage.event.PlayerScriptEvent; import ga2.stage.event.PlayerSequenceEvent; import ga2.stage.event.StatusModifierEvent; import java.io.PrintStream; import java.util.*; import kotori.data.ChangeSpecialData; import kotori.data.ScriptModelData; import kotori.geom.*; import kotori.gfx.KGLScriptModel; import kotori.io.Resource; import kotori.scp.*; import kotori.util.*; // Referenced classes of package ga2.stage: // AmpedModel, PlayerRecord, GlideCombo, StatusModifier, // Stage, PlayerActionCannon, PlayerActionWing, PlayerActionJump, // PlayerActionSnipe, PlayerActionBattle, PlayerActionMatching, PlayerAction, // StagePlayerData, VehicleContext, PlayerScriptInfo, AmpedScript, // ItemModel, StageServer, Attack, StageServerPlayerEntry, // PlayerLog, DungeonRule, GuardianRule, StagePartsModel, // Controller, PlayerController, MassBusterRule, DogfightRule, // TeamDogfightRule, CoreRule, PlayerViewModel, StageConnector, // ArcadeScene public class PlayerModel extends AmpedModel implements StageConstants { public PlayerModel(int stagemode) { npcid = -1; info = GameSetting.getSetting().scpinfo[0]; basetype = -1; wpstock = new int[10]; wpreloadtime = 1000; wpreloadrate = 1.0F; colmask = -1; layercol = true; ringoutcheck = true; ringoutgauge = 1.0F; seqs = new ArrayList(); spinscp = "spin"; HP = 1000; MP = 100; wspd = 4F; dspd = 7F; jspd = 14F; djspd = 7.5F; scpG = 1.0F; groggylimit = 10F; pow = 1.0F; tpow = 1.0F; def = 1.0F; contdef = 1.0F; change_def = false; aimrange = 5F; aimsight = 1.0F; movtune = 1.0F; rec = new PlayerRecord(); boss = false; chatmark = -1; mpusingrate = 100; pinchHP = 0; pinchHPtime = 0; glide = new GlideCombo(); damagerate = -1; lastdamagerate = -1; guardduration = 1000; pguardduration = 150; voltageval = 100; volatkrate = 1.0F; voldefrate = 1.0F; voltagerate = 100; combobutton = 0; comboidx = 0; log = new ArrayList(); mods = new StatusModifier[20]; rotenopen = false; ignoreRevive = false; parentid = -1; gentargetid = -1; tbody = 20; lyrbnd = null; } void createPlayerAction() { if(stage != null) switch(stage.getStageMode()) { case 0: // '\0' case 1: // '\001' case 4: // '\004' case 5: // '\005' case 7: // '\007' case 10: // '\n' case 16: // '\020' case 18: // '\022' case 19: // '\023' case 20: // '\024' case 21: // '\025' case 23: // '\027' case 24: // '\030' case 26: // '\032' case 27: // '\033' switch(basetype) { case 4: // '\004' action = new PlayerActionCannon(); break; case 5: // '\005' case 11: // '\013' action = new PlayerActionWing(); break; case 6: // '\006' action = new PlayerActionJump(); break; case 7: // '\007' action = new PlayerActionWing(false, true); break; case 10: // '\n' action = new PlayerActionWing(false, true); ((PlayerActionWing)action).setDoubleJumpParam(0.8F, 4F, 1.0F, 1.5F, 1.7F, 1.0F); break; case 12: // '\f' action = new PlayerActionWing(false, true); ((PlayerActionWing)action).setDoubleJumpParamLimit(0.8F, 4F, 2.0F, 0.2F, 2.3F, 0.5F, 2.05F); break; case 13: // '\r' action = new PlayerActionWing(false, false, true); ((PlayerActionWing)action).setDoubleJumpParam(0.8F, 4F, 1.0F, 1.5F, 1.7F, 1.0F); break; case 14: // '\016' action = new PlayerActionSnipe(); break; case 8: // '\b' case 9: // '\t' default: action = new PlayerActionBattle(); break; } break; case 2: // '\002' case 3: // '\003' case 6: // '\006' case 8: // '\b' case 9: // '\t' case 11: // '\013' case 12: // '\f' case 13: // '\r' case 14: // '\016' case 15: // '\017' case 17: // '\021' case 22: // '\026' case 25: // '\031' default: action = new PlayerActionMatching(); break; } else action = new PlayerActionMatching(); action.setPlayer(this); } public UserInfo getUserInfo() { return userinfo; } public int getNPCID() { return npcid; } public void setNPCID(int id) { npcid = id; } public boolean isNPC() { return npcid >= 0; } public boolean isMyPlayer() { return ctr != null && !(ctr instanceof AiController); } public void setUserInfo(UserInfo i) { setUserInfo(i, null, false, true); } public void setUserInfo(UserInfo i, boolean allset) { setUserInfo(i, null, false, allset); } public void setUserInfo(UserInfo i, UserItems items, boolean tryon) { setUserInfo(i, items, tryon, true); } public void setUserInfo(UserInfo i, UserItems items, boolean tryon, boolean allset) { GameSetting set = GameSetting.getSetting(); ga2.data.StyleData.Build oldbuild = null; if(set.lanplayenabled) oldbuild = psd != null ? psd.build : null; psd = new StagePlayerData(); short accs; if(i instanceof NPCInfo) { if(GameSetting.getSetting().lanplayenabled) { int id = ((NPCInfo)i).getID(); if(id != -1) npcid = id; if(npcid == -1) npcid = ((NPCInfo)i).getID((NPCInfo)i); } else { npcid = ((NPCInfo)i).getID(); } psd.setNPC(npcid); userinfo = i; accs = i.accs; if(set.lanplayenabled && psd.build == null && oldbuild != null) psd.build = oldbuild; } else { psd.set(stage, i); accs = (short)psd.accs; } level = psd.level; wpid = i.weapon == 0 ? set.getStyle(i.style).defweapon : ((int) (i.weapon)); WeaponData d = set.getWeapon(wpid); wp = d; if(stage != null && stage.getStageMode() == 16) wpnum = 999; else if(items != null) { if(i.weapon == 0) { wpnum = wp.maxstock; } else { ga2.data.UserItems.Item uii = items.getItem(7, wpid); wpnum = uii != null ? ((int) (uii.num)) : 0; } } else { wpnum = wp.maxstock; } if(allset) { HP = psd.MAXHP; MP = psd.MAXMP; } gutsnum = psd.sumAbility(2); int skilllevel = set.getSkill(12).skilllevel; if(!tryon && stage != null && stage.isServer() && !stage.isLoungeMode() && skilllevel <= psd.stylelv && (psd.skill1 == 12 || psd.skill2 == 12 || psd.skill3 == 12)) addVoltage(100); pinchHP = psd.sumAbility(17); if(stage != null && stage.getStageMode() == 27) pinchHP /= 2; updateStatus(); initScripts(); resetStatusModifiers(); if(d != null) { wpreloadtime = getWeaponReloadTime(d.reloadtime); int wid = psd.abilityVal(23); if(wid > 0) restoreWeapons(wid); else restoreWeapons(); } pvd = new PlayerViewData(); if(uiavatarenabled) pvd.set(thead, tface, tbody, tdeco, accs, tskin); else pvd.set(i.head, i.face, i.body, i.deco, accs, i.skin); rank = i.getRank(true).idx; if(!tryon) { userinfo = new UserInfo(); userinfo.set(i); userinfo.reduce(); } updatePlayerViewData(); boolean ride = true; if(stage != null && (stage.getStageMode() == 9 || stage.getStageMode() == 10)) ride = false; if(ride) { AccessoryData a = set.getAccs(accs); if(vehicle != null) rideOffVehicle(true); if(a != null && a.vehicle != 0 && (vehicle == null || vehicle.vehicleid != a.vehicle)) { VehicleContext vc = getVehicleContext(a.vehicle); rideVehicle(vc); } } if(psd.altitudeAutoSet && stageEntry != null) psd.altitude = stageEntry.loc.y; } public void setLevel(int _level) { psd.setLevel(_level); level = _level; HP = psd.MAXHP; MP = psd.MAXMP; updateStatus(); resetStaticStatusModifiers(); } public void setAvatar(ga2.data.NPCInfo.ChangeAvatarInfo info) { if(info == null) { return; } else { short accs = info.accs == -1 ? userinfo.accs : info.accs; short body = info.body == -1 ? userinfo.body : info.body; short deco = info.deco == -1 ? userinfo.deco : info.deco; short face = info.face == -1 ? userinfo.face : info.face; short head = info.head == -1 ? userinfo.head : info.head; int skin = info.skin == 0 ? userinfo.skin : info.skin; pvd.set(head, face, body, deco, accs, skin); return; } } boolean restoreWeapons() { boolean unlimit = stage != null && stage.unlimitedweapon; if(wp == null || !unlimit && wpnum <= 0) return false; if(unlimit && wpnum == 0) wpnum = wp.maxstock; int c = Math.min(wpnum, wp.maxstock); for(int l = 0; l < c; l++) wpstock[l] = wpid; for(int l = c; l < wpstock.length; l++) wpstock[l] = 0; return true; } boolean restoreWeapons(int wid) { WeaponData w = GameSetting.getSetting().getWeapon(wid); int c = w.maxstock; for(int l = 0; l < c; l++) wpstock[l] = wid; for(int l = c; l < wpstock.length; l++) wpstock[l] = 0; return true; } public int countWeapons() { for(int l = wpstock.length - 1; l >= 0; l--) if(wpstock[l] != 0) return l + 1; return 0; } public int getWeaponReloadTime(int defsec) { float t = (float)(defsec * 1000) * wpreloadrate; if(stage != null) switch(stage.getStageMode()) { case 8: // '\b' case 9: // '\t' default: break; case 7: // '\007' t *= 0.5F; break; case 10: // '\n' if(stage.unlimitedweapon) t = 100F; break; } return Math.max(100, (int)t); } public void decreaseWeaponHolding(int num) { if(stage.isServer() && holding != null) sendEvent(BasicAmpedEvent.create(holding.getID(), 36, new int[] { num })); } public void increaseWeapon(int num) { if(stage.isServer()) sendEvent(BasicAmpedEvent.create(getID(), 36, new int[] { num, -1 })); } public void setSpecial(int sp) { if(sp == psd.special) return; psd.setSpecial(sp); updateStatus(); initScripts(); resetStaticStatusModifiers(); if(sp <= 0) { if(userinfo != null) pvd.set(userinfo.head, userinfo.face, userinfo.body, userinfo.deco, (short)psd.accs, userinfo.skin); } else { NPCInfo npcInfo = GameSetting.getSetting().getNPCInfo(sp); if(npcInfo.changeavatar) pvd.set(npcInfo.head, npcInfo.face, npcInfo.body, npcInfo.deco, (short)psd.accs, npcInfo.skin); else if(npcInfo.resetavator && userinfo != null) pvd.set(userinfo.head, userinfo.face, userinfo.body, userinfo.deco, (short)psd.accs, userinfo.skin); } updatePlayerViewData(); updateMatrix(); updateBounds(); if(ctr instanceof AiController) { AiController aiCtr = (AiController)ctr; if(aiCtr.npcInfo != null) aiCtr.makeAttackList(aiCtr.npcInfo.tecFilter); } } public boolean isSpecial() { return psd.special > 0; } public void updatePlayerViewData() { } public PlayerViewData getPlayerViewData() { return pvd; } public StageConnector getStageConnector() { return con; } void updateStatus() { int spd = getSpeed(); pow = mapval(psd.STR, powmap); tpow = mapval(psd.TEC, powmap); def = mapval(psd.DEF, defmap) * 0.9F; contdef = mapval(psd.DEF, contdefmap); wspd = mapval(spd, walkmap) * 0.72F; dspd = getDashSpeed(spd); jspd = mapval(psd.JMP, jmpmap); aimrange = mapval(psd.TEC, rangemap) * 1.5F; aimsight = mapval(psd.TEC, sightmap); float wrr = mapval(psd.TEC, wpreloadmap); if(psd.hasAbility(45)) wrr += (wrr * (float)psd.sumAbility(45)) / 100F; wpreloadrate = wrr; int _basetype = psd.basetype; if(psd.hasAbility(24)) _basetype = psd.abilityVal(24); switch(_basetype) { case 1: // '\001' groggylimit = 20F; info = GameSetting.getSetting().scpinfo[1]; break; case 2: // '\002' groggylimit = 24F; info = GameSetting.getSetting().scpinfo[2]; break; case 3: // '\003' groggylimit = 50F; info = GameSetting.getSetting().scpinfo[3]; break; case 8: // '\b' groggylimit = 50F; info = GameSetting.getSetting().scpinfo[5]; break; case 4: // '\004' groggylimit = 10F; info = GameSetting.getSetting().scpinfo[4]; break; case 9: // '\t' groggylimit = 50F; info = GameSetting.getSetting().scpinfo[6]; break; case 5: // '\005' case 6: // '\006' case 7: // '\007' default: groggylimit = 10F; info = GameSetting.getSetting().scpinfo[0]; break; } if(basetype != psd.basetype) { basetype = psd.basetype; createPlayerAction(); } jumpcount = Math.max(0, 1 + psd.sumAbility(50)); featureflag = 0; AbilityData ab[] = psd.getAbilities(43); for(int l = 0; l < ab.length; l++) featureflag |= ab[l].val; spinscp = "spin"; ab = psd.getAbilities(54); for(int l = ab.length - 1; l >= 0; l--) { if(!KotoriUtil.isNotEmpty(ab[l].script)) continue; spinscp = ab[l].script; break; } mpusingrate = 100 + psd.sumAbility(14); ga2.data.StyleData.Build bld = psd.build; resetScale(); envboxbody.set(bld.colbnd).expand(0.1F); envboxbody.r = Math.max(envboxbody.r, bld.colr); envboxbody.s = Math.max(envboxbody.s, bld.colr); envboxbody.t = Math.max(envboxbody.t, bld.colr); if(scale.x > 1.2F) envboxbody.scale(scale.x); colbndbody.set(bld.colbnd); atkbndbody.set(bld.atkbnd); coly = bld.coly; colr = bld.colr; footy = bld.footy; footlen = bld.footlen; colmask = psd.defColMask; voltagerate = 100 + psd.sumAbility(1); if(GameSetting.getSetting().isLanguage("kr")) { if(rank >= 45) guardduration = 500; else if(rank >= 36) guardduration = 600; else if(rank >= 24) guardduration = 700; else if(rank >= 12) guardduration = 800; else if(rank >= 3) guardduration = 900; else guardduration = 1000; pguardduration = 105; } else { pguardduration = (GameSetting.getSetting().adjustbalanceflags & 1) == 0 ? 150 : 75; } } public int getJumpTime() { float jumpY = jspd; float G = Math.abs(((PlayerActionBattle)getPlayerAction()).G); int uniformVelocity = 0; return (int)((jumpY / G) * 2000F) + uniformVelocity * 2; } public float getJumpHigh() { int time = getJumpTime(); float jumpY = jspd; return jumpY * 0.001F * (float)time * 0.5F * 0.5F; } public int getWJumpTime() { float jumpY = djspd; float G = Math.abs(((PlayerActionBattle)getPlayerAction()).G); int uniformVelocity = 0; return (int)((jumpY / G) * 2000F) + uniformVelocity * 2; } public float getWJumpHigh() { int time = getWJumpTime(); float jumpY = djspd; return jumpY * 0.001F * (float)time * 0.5F * 0.5F; } static float mapval(int v, float m[]) { int idx = v / 10; int idx1 = v / 10 + 1; if(idx < m.length - 1) { idx = KMath.clamp(v / 10, 0, m.length - 1); idx1 = KMath.clamp(v / 10 + 1, 0, m.length - 1); return m[idx] + (m[idx1] - m[idx]) * ((float)(v % 10) * 0.1F); } else { idx = m.length - 2; idx1 = m.length - 1; return m[idx1] + (m[idx1] - m[idx]) * 0.1F * (float)(v - idx1 * 10); } } public int getSpeed() { int spd = psd.SPD; if(vehicle != null) { VehicleData vd = GameSetting.getSetting().getVehicle(vehicle.vehicleid); if(vd != null && vd.parts == 18) spd = psd.TEC; } return spd; } public float getDashSpeed(int spd) { return mapval(spd, dashmap) * 0.82F; } public void resetScale() { if(vehicle == null || GameSetting.getSetting().getVehicle(vehicle.vehicleid).parts != 18) { float sc = psd.build.basescale * psd.scale; scale.set(sc, sc, sc); } else { float sc = 1.0F; scale.set(sc, sc, sc); } } public void flushTechScripts() { for(int l = 0; l < psd.tec.length; l++) if(psd.tec[l] != null && psd.tec[l].data != null) psd.tec[l].data.flush(); if(wpid != 0) { WeaponData wd = GameSetting.getSetting().getWeapon(wpid); for(int l = 0; l < wd.tec.length; l++) if(wd.tec[l] != null) wd.tec[l].flush(); } } public void initScripts() { basescp = new AmpedScript[info.basescp.length]; for(int l = 0; l < basescp.length; l++) { ScriptModelData bd = (ScriptModelData)ResourceManager.getResource((new StringBuilder("/action/")).append(info.basescp[l]).toString()).getContent(); basescp[l] = bd.getScript(); setupScript(basescp[l]); } tecscpnum = 0; tecscp = new KotoriScript[20]; Comparator c = new Comparator() { public int compare(Object obj, Object obj1) { if((obj instanceof StagePlayerData.Tech) && (obj1 instanceof StagePlayerData.Tech)) { StagePlayerData.Tech t1 = (StagePlayerData.Tech)obj; StagePlayerData.Tech t2 = (StagePlayerData.Tech)obj1; return t1.srclv != t2.srclv ? t1.srclv <= t2.srclv ? -1 : 1 : 0; } else { return 0; } } final PlayerModel this$0; { this$0 = PlayerModel.this; super(); } }; StagePlayerData.Tech tmp[] = new StagePlayerData.Tech[psd.tecnum]; System.arraycopy(psd.tec, 0, tmp, 0, tmp.length); Arrays.sort(tmp, c); for(int l = 0; l < tmp.length; l++) { StagePlayerData.Tech t = tmp[l]; TechData td = t.data; KClass kc = null; ScriptModelData scm = td.getScriptModelData(); if(scm != null) kc = scm.kclass; int ksi = -1; KotoriScript ks = null; if(kc != null) { ks = null; for(int j = 0; j < basescp.length; j++) { if(kc != basescp[j].getKClass()) continue; ksi = j; ks = basescp[j]; break; } if(ks == null) { for(int j = 0; j < tecscpnum; j++) { if(tecscp[j].getKClass() != kc) continue; ksi = j + info.basescp.length; ks = tecscp[j]; break; } } if(ksi < 0) { ks = (KotoriScript)kc.newInstance(); if(ks != null) { setupScript(ks); tecscp[(ksi = tecscpnum++ + info.basescp.length) - info.basescp.length] = ks; } } } t.kmid = new int[td.scp.length]; if(ks != null) { for(int j = 0; j < t.kmid.length; j++) { KMethod _km = ks.getKClass().getKMethod(td.scp[j]); if(_km != null) t.kmid[j] = _km.idx | 256 * ksi; } } } } public void setupScript(KotoriScript s) { if(s instanceof AmpedScript) { AmpedScript a = (AmpedScript)s; a.setAmpedModel(this); switch(psd.basetype) { case 0: // '\0' a.basemove = 1.0F; break; case 1: // '\001' a.basemove = 0.7F; break; case 2: // '\002' a.basemove = 0.5F; break; case 3: // '\003' case 8: // '\b' case 9: // '\t' a.basemove = 0.3F; break; } } } public void setStageEntry(ga2.data.AmpedStageData.Entry e) { setStageEntry(e, -2); } public void setStageEntry(ga2.data.AmpedStageData.Entry e, int group) { super.setStageEntry(e, group); if(psd != null && psd.altitudeAutoSet && stageEntry != null) psd.altitude = stageEntry.loc.y; } public VehicleContext getVehicleContext() { return vehicle; } public boolean ridingVehicle() { return vehicle != null; } void rideVehicle(Object o) { if(vehicle != null) throw new IllegalStateException((new StringBuilder("already equiped : ")).append(vehicle).toString()); int scpid = 0; VehicleContext i; if(o instanceof VehicleContext) { i = (VehicleContext)o; } else { Object a[] = (Object[])o; i = (VehicleContext)a[0]; if(a[1] instanceof Integer) scpid = ((Integer)a[1]).intValue(); else setPosition((Position)a[1]); } vehicle = i; i.lastowner = getID(); psd.setVehicle(i.vehicleid); updateStatus(); initScripts(); resetStaticStatusModifiers(); if(scpid != 0) startScriptID(scpid); } public void rideAccsVehicle() { AccessoryData accs = GameSetting.getSetting().getAccs(userinfo.accs); if(accs != null && accs.vehicle != 0 && (vehicle == null || vehicle.vehicleid != accs.vehicle)) { VehicleContext vc = getVehicleContext(accs.vehicle); rideVehicle(vc); } } void rideOffVehicle(boolean useup) { if(vehicle == null) throw new NullPointerException((new StringBuilder("player[")).append(getName()).append("] has no vehicle").toString()); AmpedModel m = stage.getModel(scpargi); if((m instanceof ItemModel) && ((ItemModel)m).isPickable() && (action instanceof PlayerActionCannon)) { PlayerActionCannon pa = (PlayerActionCannon)action; ((ItemModel)m).dir = pa.basedir; } psd.setVehicle(0); vehicle = null; updateStatus(); initScripts(); resetStaticStatusModifiers(); } public void equipCarryItem(int id) { if(!stage.isServer()) return; if(vehicle != null) { return; } else { VehicleContext ctx = getVehicleContext(id); ctx.weapon = true; BasicAmpedEvent e = BasicAmpedEvent.create(getID(), 50, ctx); sendLock(); sendEvent(e); return; } } VehicleContext getVehicleContext(int id) { VehicleData d = GameSetting.getSetting().getVehicle(id); VehicleContext ctx = new VehicleContext(); ctx.lastowner = getID(); ctx.vehicleid = id; ctx.life = d.life; ctx.HP = d.HP * 10; return ctx; } public void shootCarryItem(Vector3D lpos, AttackParam ap) { shootCarryItem(lpos, ap, false); } public void shootCarryItem(Vector3D lpos, AttackParam ap, boolean isFollowAction) { if(!stage.isServer()) return; if(vehicle == null) return; VehicleContext ctx = vehicle; sendEvent(BasicAmpedEvent.create(getID(), 52)); ItemModel im = stage.createItem(); im.setVehicleContext(ctx); im.pos.set(0.0F, 0.0F, 0.0F).transform(mat); im.dir = dir; if(action instanceof PlayerActionCannon) { PlayerActionCannon pac = (PlayerActionCannon)action; im.dir = pac.basedir; } stage.addModel(im, stage.nextID()); stage.server.notifyModelAdded(im); ap = (AttackParam)ap.clone(); if(currenttech != null && currenttech.data != null) { TechData td = currenttech.data; ap.damage *= (float)td.damage * pow; ap.groggydamage *= td.groggydamage <= 0 ? td.damage : td.groggydamage; ap.button = td.button; ap.attr = ap.attr == 0 ? td.attr == 0 ? psd.baseattr : td.attr : ap.attr; } ItemActionEvent e = ItemActionEvent.create(im, isFollowAction ? 9 : 6, lpos.x, lpos.y, lpos.z, ap); stage.sendEvent(e); if(ctx.life == 0) im.broken(); } public void takeCarryItem(PlayerModel attacker) { if(!stage.isServer()) return; if(vehicle == null) return; if(attacker == null) return; VehicleContext ctx = vehicle; sendEvent(BasicAmpedEvent.create(getID(), 52)); if(ctx == null) return; VehicleData vd = GameSetting.getSetting().getVehicle(ctx.vehicleid); if(vd == null) return; if(attacker.vehicle != null) return; attacker.sendLock(); if(vd.parts != 18) attacker.sendEvent(BasicAmpedEvent.create(attacker.getID(), 50, ((Object) (new Object[] { ctx, new Integer(getKMethodID("pickItem2")) })))); } public int damageCarryItem(int d) { if(!stage.isServer()) return 10; if(vehicle == null) return 0; VehicleContext ctx = vehicle; ctx.life = Math.max(0, ctx.life - d); if(ctx.life == 0 && stage.isServer()) { BasicAmpedEvent e = BasicAmpedEvent.create(getID(), 53); sendEvent(e); } return ctx.life; } public void burnUpCarryItem(Vector3D lpos) { if(!stage.isServer()) return; if(vehicle == null) return; VehicleContext ctx = vehicle; VehicleData vd = GameSetting.getSetting().getVehicle(ctx.vehicleid); sendEvent(BasicAmpedEvent.create(getID(), 52)); ctx.life--; if(GameSetting.getSetting().getVehicle(ctx.vehicleid).basetype == 3) ctx.life = 0; ctx.HP = vd.HP * 10; ItemModel im = stage.createItem(); im.setVehicleContext(ctx); im.pos.set(lpos).transform(mat); if(action instanceof PlayerActionCannon) { PlayerActionCannon pa = (PlayerActionCannon)action; im.dir = pa.basedir; } stage.addModel(im, stage.nextID()); stage.server.notifyModelAdded(im); if(ctx.life == 0) { im.broken(); } else { KMethod km = im.getKMethod("burnup"); if(km != null) { ItemScriptEvent e = ItemScriptEvent.create(im, km.idx, 0, null); stage.sendEvent(e); } } ItemActionEvent e; if(im.itemdata.basemotion.equals("carry")) e = ItemActionEvent.create(im, 1, 0.0F, 0.0F, 0.0F); else if(im.itemdata.basetype == 2) e = ItemActionEvent.create(im, 1, 0.0F, 0.0F, 0.0F); else e = ItemActionEvent.create(im, 0, 0.0F, 0.0F, 0.0F); stage.sendEvent(e); im.updateMatrix(); } public boolean releaseCarryItem(float damage, int hsflag, String hs) { return releaseCarryItem(damage, hsflag, hs, null); } public boolean releaseCarryItem(float damage, int hsflag, String hs, PlayerModel attacker) { if(vehicle == null) return false; VehicleData d = GameSetting.getSetting().getVehicle(vehicle.vehicleid); if(d.parts != 18) { if(hsflag == 2 || hsflag == 4 || hsflag == 3) if(attacker != null) takeCarryItem(attacker); else if(!hs.equals("hit_nop")) { ShootAttack sa = new ShootAttack(0.2F, 200F, 0.0F, 3F, 1.0F); shootCarryItem(v3_1.set(0.0F, 0.6F, 1.0F), sa); } } else { vehicle.HP = Math.max(hsflag != 5 && hsflag != 7 ? 0 : 1, vehicle.HP - (int)(damage * 10F)); if(vehicle.HP == 0 || hsflag == 3) return true; } return false; } public void setGroup(int group_) { super.setGroup(group_); rec.group = group_; } public void setEntryID(int eid) { userinfo.entryid = eid; rec.entryid = eid; } public int getEntryID() { return userinfo.entryid; } public String getName() { if(gentargetid != -1) { PlayerModel pm = stage.getPlayerForModelID(gentargetid); return (new Formatter()).format(userinfo.name, new Object[] { pm == null || !KotoriUtil.isNotEmpty(pm.getName()) ? "" : pm.getName() }).toString(); } else { return userinfo.name; } } public PlayerAction getPlayerAction() { return action; } public PlayerAction.Action getAction() { return action.action; } public int getPlayerActionID() { return getPlayerActionID(false); } public int getPlayerActionID(boolean isguard) { if(isguard) { if(guardp.stat == 5) return 10; return guardp.stat != 7 ? -1 : 11; } PlayerAction.Action pa = getAction(); if((pa instanceof PlayerActionBattle.DoubleJumpAction) || ((PlayerActionBattle)action).doublejumped > 0) return 9; StagePlayerData.Tech tech = currenttech; if(tech == null) { if(attacks != null && attacks.size() > 0) { Attack a = (Attack)attacks.get(attacks.size() - 1); if(a.ap.button == 10) return 6; } return -1; } if(tech.data.states == 8 && tech.data.button == 1) return 2; if(tech.data.states == 8 && tech.data.button == 2) return 3; if(tech.data.states == 272 && tech.data.button == 1) return 4; if(tech.data.states == 272 && tech.data.button == 2) return 5; if(tech.data.button == 1) return 0; if(tech.data.button == 2) return 1; if(tech.data.button == 10) return 6; if(tech.data.button == 5 && (tech.data.requires == 0 || (tech.data.requires & 0x2000) != 0 || (tech.data.requires & 0x4000) != 0)) return 7; if(tech.data.button == 5 && (tech.data.requires & 0x8000) != 0) return 8; return (tech.data.requires & 0x1000) == 0 ? -1 : 9; } public StagePlayerData getStagePlayData() { return psd; } public AmpedProperty getProperties() { ga2.stage.event.AmpedProperty.Player t = new ga2.stage.event.AmpedProperty.Player(); t.id = getID(); if(npcid >= 0) { t.npcid = npcid; t.npceid = userinfo.entryid; t.npcboss = boss; t.level = level; if(GameSetting.getSetting().lanplayenabled) t.ui = userinfo; } else { t.ui = userinfo; } t.x = pos.x; t.y = pos.y; t.z = pos.z; t.dir = dir; t.todir = todir; int flags = (controllable ? 1 : 0) | (vanish ? 2 : 0) | (visible ? 4 : 0) | (battleoff ? 8 : 0); t.group = getGroup(); t.voltagelv = voltagelv; t.mark = mark; t.chatmark = chatmark; t.flags = flags; t.guardmode = guardmode; t.areahash = areahash; if(!stage.isLoungeMode()) { t.HP = HP; t.MP = MP; t.wpstock = wpstock; t.wpnum = wpnum; } t.matchingflags = matchingflags; t.special = psd.special; t.vc = vehicle; if(state == 128) t.sit = true; else t.sit = false; if(entry != null) t.roten = entry.userinfo.condition == 4; t.rotenargv = t.roten ? scpargv : null; t.emonum = emotionnum; t.continuedemo = continuedemo; t.layercol = layercol; if(tryonUserInfo != null) { t.enableTryon = true; t.tryonStyle = tryonUserInfo.style; t.tryonHead = tryonUserInfo.head; t.tryonFace = tryonUserInfo.face; t.tryonBody = tryonUserInfo.body; t.tryonDeco = tryonUserInfo.deco; t.tryonAccs = tryonUserInfo.accs; t.tryonSkin = tryonUserInfo.skin; t.tryonBuild = tryonUserInfo.build; } if(psd.altitudeEnabled) t.altitude = psd.altitude; t.parentid = parentid; t.gentargetid = gentargetid; t.uiavatarenabled = uiavatarenabled; t.thead = thead; t.tface = tface; t.tbody = tbody; t.tdeco = tdeco; t.tskin = tskin; return t; } public void setProperties(ga2.stage.event.AmpedProperty.Player t) { if(t.enableTryon) { if(tryonUserInfo == null) tryonUserInfo = new UserInfo(); tryonUserInfo.style = t.tryonStyle; tryonUserInfo.head = t.tryonHead; tryonUserInfo.face = t.tryonFace; tryonUserInfo.body = t.tryonBody; tryonUserInfo.deco = t.tryonDeco; tryonUserInfo.accs = t.tryonAccs; tryonUserInfo.skin = t.tryonSkin; tryonUserInfo.build = t.tryonBuild; } else { tryonUserInfo = null; } NPCInfo ni = null; UserInfo ui; if(t.npcid >= 0) { npcid = t.npcid; level = t.level; ni = GameSetting.getSetting().getNPCInfo(npcid); GetAmped2 ga2 = GetAmped2.getAmped2(); if(ga2 != null && ga2.isLanPlay() && GameSetting.getSetting().lanplayenabled && t.ui != null && !ni.name.equals(t.ui.name)) ni.name = t.ui.name; userinfo = new UserInfo(); userinfo.set(ni); parentid = t.parentid; gentargetid = t.gentargetid; if(t.uiavatarenabled) { userinfo.head = t.thead; userinfo.face = t.tface; userinfo.body = t.tbody; userinfo.deco = t.tdeco; userinfo.skin = t.tskin; } userinfo.entryid = t.npceid; boss = t.npcboss; ui = userinfo; } else { level = 0; userinfo = t.ui; ui = t.enableTryon ? tryonUserInfo : userinfo; } psd = new StagePlayerData(); short accs; if(t.npcid >= 0) { psd.setNPC(npcid); psd.setLevel(level); accs = ui.accs; } else { psd.set(stage, ui); accs = (short)psd.accs; } updateStatus(); initScripts(); resetStatusModifiers(); pvd = new PlayerViewData(); pvd.set(ui.head, ui.face, ui.body, ui.deco, accs, ui.skin); if(ni != null) { setAvatar(ni.getChangeAvatar()); if(pvd.skin != 0 && ni.skin != 0) pvd.set(pvd.head, pvd.face, pvd.body, pvd.deco, pvd.accs, ni.skin); } updatePlayerViewData(); pos.set(t.x, t.y, t.z); dir = t.dir; todir = t.todir; setGroup(t.group); HP = t.HP; MP = t.MP; voltagelv = t.voltagelv; mark = t.mark; chatmark = t.chatmark; int flags = t.flags; controllable = (flags & 1) != 0; vanish = (flags & 2) != 0; setVisible((flags & 4) != 0); battleoff = (flags & 8) != 0; guardmode = t.guardmode; areahash = t.areahash; matchingflags = t.matchingflags; if(t.wpstock != null) wpstock = t.wpstock; wpnum = t.wpnum; wpid = userinfo.weapon == 0 ? GameSetting.getSetting().getStyle(userinfo.style).defweapon : ((int) (userinfo.weapon)); WeaponData d = GameSetting.getSetting().getWeapon(wpid); wp = d; if(d != null) wpreloadtime = getWeaponReloadTime(d.reloadtime); if(t.special != 0) setSpecial(t.special); VehicleContext _v = t.vc; if(vehicle != null) rideOffVehicle(true); if(_v != null) rideVehicle(_v); if(isDead()) startScript("dead"); updateMatrix(); updateBounds(); if(t.sit) state = 128; rotenopen = t.roten; if(t.roten) scpargv = t.rotenargv; emotionnum = t.emonum; continuedemo = t.continuedemo; layercol = t.layercol; if(psd.altitudeEnabled) psd.altitude = t.altitude; } void addGetItem(ItemInfo itinfo) { GameSetting set = GameSetting.getSetting(); if(set.version >= 0 && itinfo.subid >= 0 && itinfo.typeid == 12 && set.getMaterial(itinfo.subid).isPrivately()) return; ga2.data.UserItems.Item it = new ga2.data.UserItems.Item(itinfo.typeid, itinfo.subid); boolean money = it.kind == 22 || it.kind == 23; int idx = -1; for(int i = 0; i < rec.getItem.size(); i++) { ga2.data.UserItems.Item getit = (ga2.data.UserItems.Item)rec.getItem.get(i); if(it.kind != getit.kind || !money && it.id != getit.id) continue; idx = i; break; } if(idx == -1) { it.num = 1; rec.getItem.add(it); } else if(money) ((ga2.data.UserItems.Item)rec.getItem.get(idx)).id += it.id; else ((ga2.data.UserItems.Item)rec.getItem.get(idx)).num++; } void resetPlayer() { stopScript(); UserInfo ui = userinfo; short accs; if(npcid >= 0) { psd.setNPC(npcid); psd.setLevel(level); accs = ui.accs; } else { psd.set(stage, ui); accs = (short)psd.accs; } gutsnum = psd.sumAbility(2); int skilllevel = GameSetting.getSetting().getSkill(12).skilllevel; if(stage.isServer() && !stage.isLoungeMode() && skilllevel <= psd.stylelv && (psd.skill1 == 12 || psd.skill2 == 12 || psd.skill3 == 12)) addVoltage(100); pinchHP = psd.sumAbility(17); if(stage.getStageMode() == 27) pinchHP /= 2; updateStatus(); initScripts(); resetPlayerStatusModifiers(); pvd = new PlayerViewData(); pvd.set(ui.head, ui.face, ui.body, ui.deco, accs, ui.skin); updatePlayerViewData(); } public boolean isVanished() { return vanish; } public boolean isBattleOff() { return battleoff; } public boolean isFeatureFlag(int flag) { return (featureflag & flag) != 0; } public void resetBattleState() { battlestate = 0; } public void setAimOff(boolean b) { if(b) battlestate |= 1; else battlestate &= -2; } public boolean isAimOff() { return (battlestate & 1) != 0 || isFeatureFlag(2); } public void setConfusion(boolean b) { if(b) battlestate |= 2; else battlestate &= -3; } public boolean isConfusion() { return (battlestate & 2) != 0; } public void start(int t) { super.start(t); time = t; starttime = t; } public void updateMatrix() { Quaternion.getRotateQuaternion(dir, 0.0F, 1.0F, 0.0F, rot); super.updateMatrix(); } public void updateBounds() { colbnd.set(colbndbody).scale(scale.x).offset(pos); atkbnd.set(atkbndbody).scale(scale.x).offset(pos); super.updateBounds(); } public void setController(Controller c) { ctr = c; } public int getTime() { return time; } public boolean isDead() { return HP <= 0; } public void setMatchingFlags(int f) { matchingflags = f; } public void addPlayerLog(int id, float val, int flags) { if(stage.isLoungeMode()) { return; } else { PlayerLog p = new PlayerLog(id, val, flags, time); log.add(p); return; } } public PlayerModel getAimTarget() { if(state != 4 && state != 256) return null; if(action instanceof PlayerActionSnipe) { AmpedModel am = stage.getModel(((PlayerActionSnipe)action).targetid); if(am instanceof PlayerModel) return (PlayerModel)am; } else if(action instanceof PlayerActionBattle) { AmpedModel am = stage.getModel(((PlayerActionBattle)action).aimaction.targetid); if(am instanceof PlayerModel) return (PlayerModel)am; } return null; } public float getRingoutGauge() { return ringoutgauge; } public boolean isSittable() { return vehicle == null; } private boolean hasGuts() { if(stage.getStageMode() == 27 && rec.diept > 0) return false; if(gutsnum > 0) return true; if(npcid >= 0) return false; if(stage.isVersusMonsterMode()) { if(stage.rule instanceof DungeonRule) { DungeonRule rule = (DungeonRule)stage.rule; return rule.hasGutsSkill(); } ItemAdditionalData iadata = entry.useritems.getItemAdditionalData(); if(iadata != null) { ga2.data.ItemAdditionalData.Info info = iadata.getSkillInfo_Ability(psd.accs, 39); return info != null && info.getValue() > 0; } } return false; } private void decGuts() { if(gutsnum > 0) gutsnum--; else if(stage.rule instanceof GuardianRule) { GuardianRule rule = (GuardianRule)stage.rule; rule.decGuts(getEntryID()); } } public int getKMethodID(String s) { return getKMethodID(s, false); } public int getKMethodID(String s, boolean tecscp_last) { KMethod km = null; int tecscp_no = 0; for(int l = 0; l < tecscpnum; l++) { KMethod tkm = tecscp[l].getKClass().getKMethod(s); if(tkm == null) continue; km = tkm; tecscp_no = l; if(!tecscp_last) break; } if(km != null) return km.idx | 256 * (tecscp_no + info.basescp.length); for(int l = 0; l < basescp.length; l++) { km = basescp[l].getKClass().getKMethod(s); if(km != null) return km.idx | 256 * l; } KotoriScript ks = wp.tec[0].getScriptModelData().getScript(); setupScript(ks); km = ks.getKClass().getKMethod(s); if(km != null) return -km.idx; else return 0; } public boolean startScriptID(int id) { if(id == 32768) return false; if(isStageScript(id)) { int _id = -id; if(stage.stageaction == null) return false; KMethod km = stage.stageaction.getKMethod((new StringBuilder("scp")).append(_id).toString()); if(km == null) { return false; } else { AmpedScript s = (AmpedScript)stage.stageaction.newInstance(); setupScript(s); return startScript(s, km, 0); } } if(isHitScript(id)) return startScript(basescp[id / 256], basescp[id / 256].getKClass().methods[id & 0xff], 0); KotoriScript s = tecscp[id / 256 - info.basescp.length]; if(s == null || s.getKClass().methods.length <= (id & 0xff)) return false; else return startScript(s, s.getKClass().methods[id & 0xff], 0); } public boolean isStageScript(int id) { return id < 0; } public boolean isHitScript(int id) { return id >= 0 && id < 256 * info.basescp.length; } public boolean startWeaponScript(String scp) { KotoriScript ks = wp.tec[0].getScriptModelData().getScript(); setupScript(ks); KMethod km = ks.getKClass().getKMethod(scp); return startScript(ks, km, 0); } public KMethod getKMethod(String s) { for(int l = 0; l < basescp.length; l++) { KMethod km = basescp[l].getKClass().getKMethod(s); if(km != null) return km; } return script != null ? script.getKClass().getKMethod(s) : null; } public boolean startScript(String s, int dt) { if(kframe != null && _ss(kframe.getKScript(), s, dt)) return true; for(int l = 0; l < basescp.length; l++) if(_ss(basescp[l], s, dt)) return true; for(int l = 0; l < tecscpnum; l++) if(_ss(tecscp[l], s, dt)) return true; return false; } private boolean _ss(KScript ks, String s, int dt) { if(ks == null) return false; KMethod km = ks.getKClass().getKMethod(s); if(km != null) return startScript(ks, km, dt); else return false; } public boolean startScript(KScript ks, KMethod km, int dt) { if(km == null) return false; boolean resetval = false; if(atkoffscp != null) resetval = true; stopScript(); if(resetval) { hittype = lasthittype; hitkind = lasthitkind; } landscp = null; landstop = false; wallscp = null; hitscp_ok = null; hitscp_guarded = null; hitscp_air = null; hitscp_emptyMP = null; hitlv = 10; hitstop = 0; comboinput = false; guardinput = false; spininput = false; wakeinput = false; scpG = 1.0F; disableactG = false; scplocked = false; combobutton = 0; lockactioninterrupt = false; if(ks instanceof AmpedScript) { AmpedScript as = (AmpedScript)ks; if(av.equals(0.0F, 0.0F, 0.0F)) rot.transform(av.set(0.0F, 0.0F, -1F)); as.vx = av.x; as.vy = av.y; as.vz = av.z; as.backhit = aback; as.poffs = null; as.qoffs = null; as.combo = comboidx; } super.startScript(ks, km, dt); return true; } public boolean callScript(String s) { if(kframe != null) { KScript ks = kframe.getKScript(); if(ks != null) { KMethod km = ks.getKClass().getKMethod(s); if(km != null) return callScript(ks, km, 0); } } return callScriptID(getKMethodID(s), 0); } public boolean callScriptID(int id) { return callScriptID(id, 0); } public boolean callScriptID(int id, int dt) { if(id < 0) return false; if(id < 1024) { return callScript(basescp[id / 256], basescp[id / 256].getKClass().methods[id & 0xff], 0); } else { KotoriScript s = tecscp[id / 256 - info.basescp.length]; return callScript(s, s.getKClass().methods[id & 0xff], dt); } } public boolean callScript(KScript ks, KMethod km, int dt) { if(km == null) return false; KFrame cf = kframe; scpG = 1.0F; disableactG = false; KFrame kf = KFrame.start(ks, km); kf.setTime(getClock().getTime()); kf.addDt(dt); if(cf != null) { cf.callFrame(kf); kf = cf; } kframe = kf != KFrame.STOPPED ? kf : null; return true; } private KScript findKScript(KClass kc) { for(int l = 0; l < basescp.length; l++) if(basescp[l].getKClass() == kc) return basescp[l]; for(int l = 0; l < tecscpnum; l++) if(tecscp[l].getKClass() == kc) return tecscp[l]; return null; } private KScript findKScript(KMethod m) { return findKScript(m.getKClass()); } protected void scriptStopped(KScript ks, KMethod km, int mode) { colmask = psd.defColMask; ringoutcheck = true; holdtarget = -1; holding = null; holdreleasescp = null; guardtype = 0; atkoffscp = null; lockactioninterrupt = false; damagerate = -1; hittype = 0; hitkind = 0; if(attacks != null) { for(int l = 0; l < attacks.size(); l++) { Attack a = (Attack)attacks.get(l); if(a.ap.autokill) { a.kill(); attacks.remove(l); l--; } } } combomode = 0; resetBattleState(); } public boolean isEmotionRunning() { if(kframe != null && (kframe.getKScript() instanceof AmpedScript)) return ((AmpedScript)kframe.getKScript()).isemotion; else return false; } public boolean isGeneratedNPC() { return isNPC() && parentid > -1; } public boolean update() { if(vanish) { time = stage.getTime(); return alive; } int dt = stage.getTime() - time; float px = pos.x; float py = pos.y; float pz = pos.z; StagePartsModel pg = groundparts; updateItemContext(dt); updateAction(); updateControl(); updateVoltage(dt, false); updateStatusModifier(); updateGenerateNPC(); if(groundparts != null && groundparts.movingfloor) { if(groundparts == pg && (state & 0x110) == 0) { float fdt = (float)dt * 0.001F; v3_1.set(groundlocalpos).transform(groundparts.mat).sub(px, py, pz).scale(1.0F / fdt); v3_1.y = 0.0F; if(!Float.isNaN(v3_1.x) && !Float.isNaN(v3_1.z) && v3_1.lengthSq() * fdt < 2.0F && v3_1.lengthSq() >= 0.0001F) { float oldvx = v.x; float oldvy = v.y; float oldvz = v.z; Polygon p[] = getStage().getStagePolygons(envbox, v3_1, fdt); move(v3_1, fdt, p, true); v.set(oldvx, oldvy, oldvz); } } groundparts.mat.invert(m_1); groundlocalpos.set(pos).transform(m_1); } checkAlive(); return alive; } void updateGenerateNPC() { if(parentid == -1 || !stage.isServer()) return; if(parentid >= -2 && isDead() && holder == null && (getRunningKFrame() == null || !stage.ringContains(pos)) && (attacks == null || attacks.size() == 0)) { stage.sendEvent(BasicAmpedEvent.create(getID(), 71)); parentid = -3; } else if(parentid >= 0 && !isDead() && getRunningKFrame() == null && alivetime != 0 && stage.getTime() - starttime >= alivetime) { avoidAttack(200); Vector3D v0 = new Vector3D(0.0F, 0.0F, 0.0F); PlayerAttackedEvent e = PlayerAttackedEvent.create(this, 42, 0, -1, getKMethodID("hit_bc2"), v0, v0, -1, 2, 0); sendEvent(e); parentid = -2; } } protected int updateItemContext(int dt) { if(vehicle == null || vehicle.life == 0) return -1; int i = vehicle.countDown(dt, getRunningKFrame() == null); if(i == 0 && stage.isServer()) { vehicle.life = 0; sendLock(); sendEvent(PlayerScriptEvent.create(this, getKMethodID("carrytimeup"), 0, null)); } return i; } void updateAction() { int t = stage.getTime(); if(t - time <= 0) return; if(t - time > 10000) time = t - 20; if(stage.isLoungeMode()) { while(t - time > 500) { updateAction(100); time += 100; if(t - time > 1000) time = t; } while(t - time > 50) { updateAction(40); time += 40; if(t - time > 1000) time = t; } } else { while(t - time > 500) { updateAction(60); time += 60; if(t - time > 1000) time = t; } while(t - time > 30) { updateAction(20); time += 20; if(t - time > 1000) time = t; } } if(t - time >= 1) updateAction(t - time); time = t; } protected void updateAction(int dt) { float fdt = (float)dt * 0.001F; updateEventVolume(); if(!seqs.isEmpty()) { PlayerEvent e = (PlayerEvent)seqs.get(0); if(time >= e.time) { e.x = pos.x; e.y = pos.y; e.z = pos.z; e.dir = dir; processAmpedEvent(e, false, false); if(seqs == null || seqs.isEmpty()) { System.err.println("WARNING : interrupted processing the sequence events."); Thread.dumpStack(); } else { seqs.remove(0); } } } updateKFrame(dt); if(holder != null) if(holder.holding != this) { PlayerModel holderTmp = holder; holdRecovered(); holder = null; if(isDead()) { startScript("hit_ba"); } else { stopScript(); recoverPlayer(); recentAttacker = getTeamAttack(holderTmp) != 1 ? ((AmpedModel) (holderTmp)) : null; } } else { pos.set(holder.holdreleasepos).transform(holder.mat); dir = holder.dir; todir = holder.dir; updateMatrix(); updateBounds(); updateGlideCombo(dt); return; } updateDir(fdt); if(action != null) action.update(fdt); if(!isDead()) if(ringouton) ringoutgauge = Math.max(0.0F, ringoutgauge - fdt * 0.22F); else ringoutgauge = Math.min(1.0F, ringoutgauge + fdt * 0.18F); updateMatrix(); updateBounds(); ringoutCheck(); updateAttacks(dt); updateGroggy(dt); updateGlideCombo(dt); } void updateKFrame(int dt) { if(kframe != null) { boolean prevComboinput = comboinput; int prevCombobutton = combobutton; KScript ks = kframe.getKScript(); KMethod km = kframe.getKMethod(); KFrame kf = kframe; KFrame old = kframe; kf.addDt(dt); scprunningtime += dt; kf = KFrame.exec(kf); if(kf != KFrame.STOPPED) { kframe = kf; } else { scriptStopped(ks, km, 0); if(kframe != null && kframe.getKMethod() != null && "xcguard_cnt".equals(kframe.getKMethod().name)) { guardtype = lastguard; damagerate = lastdamagerate; damageratetype = lastdamageratetype; } if(kframe == old) { kframe = null; recoverPlayer(); } } if(kf == null) { scriptStopped(ks, km, 0); recoverPlayer(); } } } public void setAccsVisible() { } public void setAccsVisibleTime(int i) { } void accsVisibleMode(int i) { } public void updateEventVolume() { movtune = 1.0F; stage.updateEventVolume(this); } public float getToDir() { return todir; } public void setToDir(float d) { todir = d; } void updateDir(float fdt) { if(todir != dir) { boolean b = time < stresstime; float spd = b ? 6F : 12F; float k = b ? 3F : 6F; float d = KMath.unitdir(dir); float td = KMath.unitdir(todir); float sd = KMath.getSubDir(d, td); float dlen = Math.abs(sd); float dspd = (spd + k * dlen) * psd.turnspeed * fdt; if(dspd < dlen) dir = d + dspd * (float)(sd >= 0.0F ? 1 : -1); else dir = td; } } void checkAlive() { if(!alive) return; if(!isDead()) return; if(stage.currentepkind != 6 && stage.currentepkind != 2) return; if(getGroup() != 5) return; if(holder != null) return; if(!stage.ringContains(pos)) { alive = false; return; } if(getAttackSize() != 0) return; if(getRunningKFrame() != null) { return; } else { alive = false; return; } } public boolean isControllable() { return stage.controllable || controllable; } public boolean isControllableNPC() { return stage.controllablenpc; } private void updateControl() { if(ctr != null && (isControllable() || isControllableNPC()) && (!isDead() || (ctr instanceof AiController))) { if(isControllable() || isControllableNPC() && isNPC()) { boolean seqoff = seqs.isEmpty(); ctr.update(); Controller.Event e = ctr.nextControl(time > actlock && seqoff, time > atklock && seqoff); if(e != null) action.controll(e); } if(!(ctr instanceof AiController) && con != null && wpstock[0] == 0 && time >= wpreloadstart + wpreloadtime) { wpreloadstart = 0x7fffffff - wpreloadtime - 1; sendEvent(BasicAmpedEvent.create(getID(), 37)); } } } public void recoverPlayer() { if(HP > 0 && (holder == null || holder.holding != this)) { stresstime = time + 200; action.recover(); } if(change_def) { def = mapval(psd.DEF, defmap) * 0.9F; contdef = mapval(psd.DEF, contdefmap); change_def = false; } if(!isSittable() && (ctr instanceof PlayerController)) ((PlayerController)ctr).resetSit(); currenttech = null; comboidx = 0; flowflag = false; downflag = false; recentAttacker = null; lastguard = 0; lastdamagerate = -1; lastdamageratetype = 0; lasthittype = 0; lasthitkind = 0; toPos = null; landavoidatktime = 0; wallavoidatktime = 0; } public Controller.Event recoverController() { if(ctr != null) { ctr.flush(); return ctr.nextControl(true, false); } if(ctr != null) isControllable(); return null; } public void lockAction(int t) { if(ctr instanceof AiController) t = Math.max(100, (t * 3) / 2); actlock = Math.max(actlock, time + t); } public void lockAttack(int t) { atklock = Math.max(atklock, time + t); } void controllAttack(int button) { if(holder != null) return; if(stage.isTeamStreetfightMode() && battleoff) return; boolean vehicle_guard = vehicle != null ? GameSetting.getSetting().getVehicle(vehicle.vehicleid).guard : true; int i; if(getRunningKFrame() != null) { if(comboinput) combobutton = button; if(spininput && button == 5 && MP >= 20) { avoidAttack(200); spininput = false; int scpid = getKMethodID(spinscp); sendEvent(PlayerScriptEvent.create(this, scpid, ctr.getCursorDir(), null)); return; } if(wakeinput) { i = getTech(button, 0x20000); if(i >= 0 && !applyStatusModifier(83, 0, psd.tec[i].data)) { int rdir = 0; if(ctr != null && !psd.tec[i].data.turndisabled) { int cdir = ctr.getCursorDir(); if(cdir > 0) { cdir = (cdir - 1) * 8; int pdir = (int)(KMath.unitdir(dir / 3.141593F) * 16F * 8F); cdir -= pdir; if(cdir > 127) cdir -= 256; if(cdir < -128) cdir += 256; if(cdir < -24) cdir = -24; if(cdir > 24) cdir = 24; rdir = cdir; } } avoidAttack(200); wakeinput = false; sendEvent(PlayerAttackEvent.create(this, 40, i, 0, rdir, 0, 0, 0)); return; } } if(guardinput && button > 0 && vehicle_guard) { if(guardmode == 1 && isDefent(lastattacked) || guardbutton != 0 && guardbutton != button) { i = getTech(button, 4096); if(i >= 0) { if(HP > 10) if(stage.isDungeonMode()) sendEvent(BasicAmpedEvent.create(getID(), 34, new Integer[] { Integer.valueOf(HP - ((GameSetting.getSetting().adjustbalanceflags & 1) == 0 ? 30 : 15)), Integer.valueOf(1) })); else sendEvent(BasicAmpedEvent.create(getID(), 34, Math.max(10, HP - ((GameSetting.getSetting().adjustbalanceflags & 1) == 0 ? 30 : 15)))); sendEvent(PlayerAttackEvent.create(this, 40, i, 0, 0, 0, 0, 0)); guardinput = false; return; } } if(!isFeatureFlag(4)) { if(guardmode == 1 && button == 5) sendEvent(PlayerScriptEvent.create(this, 39)); if(guardmode == 0 && button < 3) { sendEvent(BasicAmpedEvent.create(getID(), 44, button)); guardinput = false; } } } return; } if(!psd.disableitem && psd.optionview == null && (state == 1 || state == 2) && vehicle == null && (button == 1 || button == 2) && findCarryItem()) return; if(guardmode == 1 && !isFeatureFlag(4) && (state == 1 || state == 2) && vehicle_guard && button == 5) { sendEvent(PlayerScriptEvent.create(this, 39)); return; } finishhit = false; i = getTech(button); if(i >= 0 && !applyStatusModifier(83, 0, psd.tec[i].data)) { getAttackPos(i_1); sendEvent(PlayerAttackEvent.create(this, 40, i, 0, 0, i_1[0], i_1[1], i_1[2])); } } boolean deadAttack(boolean check) { if(!isDead()) return false; int i = getDeadAttack(); if(i >= 0) { if(!check && stage.isServer()) { getAttackPos(i_1); sendEvent(PlayerAttackEvent.create(this, 40, i, 0, 0, i_1[0], i_1[1], i_1[2])); } return true; } else { return false; } } boolean findCarryItem() { rot.transform(v3_1.set(0.0F, 0.0F, 0.2F)); r_1.set(envbox); r_1.x += v3_1.x; r_1.y += v3_1.y; r_1.z += v3_1.z; AmpedModel m[] = stage.getModels(r_1); for(int l = 0; l < m.length && m[l] != null; l++) { if(!(m[l] instanceof ItemModel)) continue; ItemModel im = (ItemModel)m[l]; if(!im.isPickable()) continue; VehicleData vd = GameSetting.getSetting().getVehicle(im.ctx.vehicleid); if(vd.parts == 18) { Rect3D r = im.envbox; if(pos.y <= r.y || envbox.x - envbox.r - 0.2F > r.x || envbox.x + envbox.r + 0.2F < r.x || envbox.z - envbox.t - 0.2F > r.z || envbox.z + envbox.t + 0.2F < r.z) continue; } sendEvent(PlayerScriptEvent.create(this, getKMethodID("pickItem"), im.getID(), null)); return true; } return false; } int getCarryItemID() { rot.transform(v3_1.set(0.0F, 0.0F, 0.2F)); r_1.set(envbox); r_1.x += v3_1.x; r_1.y += v3_1.y; r_1.z += v3_1.z; AmpedModel m[] = stage.getModels(r_1); for(int l = 0; l < m.length && m[l] != null; l++) { if(!(m[l] instanceof ItemModel)) continue; ItemModel im = (ItemModel)m[l]; if(!im.isPickable()) continue; VehicleData vd = GameSetting.getSetting().getVehicle(im.ctx.vehicleid); if(vd.parts == 18) { Rect3D r = im.envbox; if(pos.y <= r.y || envbox.x - envbox.r - 0.2F > r.x || envbox.x + envbox.r + 0.2F < r.x || envbox.z - envbox.t - 0.2F > r.z || envbox.z + envbox.t + 0.2F < r.z) continue; } return im.getID(); } return -1; } Vector3D clearCarryItem(int id) { if(id == -1) return null; AmpedModel m[] = stage.getModels(); for(int l = 0; l < m.length && m[l] != null; l++) if(m[l] instanceof ItemModel) { ItemModel im = (ItemModel)m[l]; if(im.getID() == id) { im.getStage().sendEvent(BasicAmpedEvent.create(im.getID(), 66)); return im.pos; } } return null; } void chargeAttackGained(String s, int i) { } void controllChargeAttack(int tid, int ci) { finishhit = false; int i = tid; if(i >= 0) { getAttackPos(i_1); sendEvent(PlayerAttackEvent.create(this, 40, i, ci, 0, i_1[0], i_1[1], i_1[2])); } } public void comboInput(boolean b) { comboinput = b; } public void guardInput(boolean b) { guardinput = b; } public void spinInput(boolean b) { spininput = b; } public void wakeInput(boolean b) { wakeinput = b; } public boolean getComboInput() { return comboinput; } public void guardContinue() { if(guardmode == 0) { return; } else { StagePlayerData.Tech t = new StagePlayerData.Tech(); currenttech = t; startScriptID(getKMethodID("xcguard_cnt", true)); return; } } public void guardOn(int type) { guardtype = type; lastguard = guardtype; } public void comboMode(int i) { combomode = i; } public void damageRate(int t, int r) { damagerate = r; damageratetype = t; lastdamagerate = damagerate; lastdamageratetype = damageratetype; } public void setHitType(int t, int k) { hittype = t; hitkind = k; lasthittype = hittype; lasthitkind = hitkind; } public void nextAttack() { if(!comboinput) return; if(ctr instanceof AiController) combobutton = ((AiController)ctr).nextAttack(comboidx); if(combobutton == 0) return; int rdir = 0; if(ctr != null) { int cdir = ctr.getCursorDir(); if(cdir > 0) { cdir = (cdir - 1) * 8; int pdir = (int)(KMath.unitdir(dir / 3.141593F) * 16F * 8F); cdir -= pdir; if(cdir > 127) cdir -= 256; if(cdir < -128) cdir += 256; if(cdir < -24) cdir = -24; if(cdir > 24) cdir = 24; rdir = cdir; } } if(combobutton == 10) { if(wpstock[0] == 0) return; int i = getItemTech(10); WeaponData _wp = GameSetting.getSetting().getWeapon(wpstock[0]); if(i >= 0 && !applyStatusModifier(83, 2, _wp.tec[i])) { boolean infinity = applyStatusModifier(98, 0, null); sendEvent(PlayerAttackEvent.create(this, 41, wpstock[0] << 8 | i & 0xff, infinity ? 15 : 0, rdir, attackddir, attackdpitch, attackdd)); } } else { if(ctr != null && guardmode == 1 && combobutton == 5 && (state & 7) != 0 && (ctr.getPressedButton() & 0x80) == 0) return; int i = getTech(combobutton); if(i >= 0) { if(!psd.tec[i].data.combotech) comboidx = -1; if(ctr instanceof AiController) { int tid = ((AiController)ctr).target() == null ? -1 : ((AiController)ctr).target().getID(); sendEvent(PlayerAttackEvent.create(this, 128, i, ++comboidx, rdir, attackddir, attackdpitch, attackdd, tid)); } else if(!applyStatusModifier(83, 0, psd.tec[i].data)) sendEvent(PlayerAttackEvent.create(this, 40, i, ++comboidx, rdir, attackddir, attackdpitch, attackdd)); } } } public void nextAttack(String teckey) { nextAttack(teckey, false); } public void nextAttack(String teckey, boolean changedir) { if(!comboinput) return; int rdir = 0; if(changedir && ctr != null) { int cdir = ctr.getCursorDir(); if(cdir > 0) { cdir = (cdir - 1) * 8; int pdir = (int)((KMath.unitdir(dir) / 3.141593F) * 16F * 8F); cdir -= pdir; if(cdir > 127) cdir -= 256; if(cdir < -128) cdir += 256; if(cdir < -24) cdir = -24; if(cdir > 24) cdir = 24; rdir = cdir; } } int i = getTech(combobutton, teckey); if(i >= 0) if(ctr instanceof AiController) { int tid = ((AiController)ctr).target() == null ? -1 : ((AiController)ctr).target().getID(); sendEvent(PlayerAttackEvent.create(this, 128, i, comboidx = 0, rdir, attackddir, attackdpitch, attackdd, tid)); } else if(!applyStatusModifier(83, 0, psd.tec[i].data)) sendEvent(PlayerAttackEvent.create(this, 40, i, comboidx = 0, rdir, attackddir, attackdpitch, attackdd)); } public void controllItem() { if(holder != null) return; if(psd.disableitem || psd.optionview != null) return; if(vehicle != null) { controllAttack(1); return; } if(wpstock[0] == 0) return; if(battleoff) return; if(getRunningKFrame() != null) { if(comboinput) combobutton = 10; return; } int i = getItemTech(10); WeaponData _wp = GameSetting.getSetting().getWeapon(wpstock[0]); if(i >= 0 && !applyStatusModifier(83, 2, _wp.tec[i])) { getAttackPos(i_1); boolean infinity = applyStatusModifier(98, 0, null); sendEvent(PlayerAttackEvent.create(this, 41, wpstock[0] << 8 | i & 0xff, infinity ? 15 : 0, 0, i_1[0], i_1[1], i_1[2])); } } public int[] getAttackPos() { getAttackPos(i_1); return i_1; } void getAttackPos(int i[]) { float dirdot = 0.0F; float pitchdot = 0.0F; float d = 10F; AmpedModel am[] = stage.getAttackTargets(mat, 1.0F, 1.0F, 4F); for(int l = 0; l < am.length && am[l] != null; l++) { if(am[l] == this || !(am[l] instanceof PlayerModel)) continue; PlayerModel p = (PlayerModel)am[l]; if(p.isDead() || getTeamAttack(p) != 0) continue; v3_1.set(1.0F, 0.0F, 0.0F).transform0(mat); v3_1.y = 0.0F; v3_1.normalize(); v3_2.set(p.mat.e[12], p.mat.e[13], p.mat.e[14]).sub(pos); v3_2.y = 0.0F; v3_2.normalize(); dirdot = v3_1.dot(v3_2); v3_1.set(0.0F, 1.0F, 0.0F); v3_2.set(p.mat.e[12], p.mat.e[13], p.mat.e[14]).sub(pos); v3_2.normalize(); pitchdot = v3_1.dot(v3_2); d = KMath.clamp(Vector3D.hypot(mat.e[12], mat.e[13], mat.e[14], p.mat.e[12], p.mat.e[13], p.mat.e[14]) - envbox.r * 0.8F - p.envbox.r * 0.8F, 0.0F, 12F); break; } i[0] = (int)(dirdot * 64F); i[1] = (int)(pitchdot * 32F); i[2] = (int)(d * 10F); } public void setAttackPowerExp(int exp) { applyStatusModifier(71, 0, new Integer(exp)); } public int getTech(int button) { return getTech(button, ((String) (null))); } public int getTech(int button, String key) { TechData td = currenttech == null ? null : currenttech.data; if(td != null && td.combolockbutton && button != td.button) return -1; int cdir = -1; if(ctr != null) { cdir = ctr.getCursorDir(); if(cdir != 0) { cdir--; int pdir = (int)(KMath.unitdir(dir / 3.141593F) * 16F); cdir = (cdir - pdir) / 4; if(cdir < 0) cdir += 8; } else { cdir = -1; } } for(int l = psd.tecnum - 1; l >= 0; l--) { StagePlayerData.Tech t = psd.tec[l]; if(teckcheck(button, cdir, t.data, key)) return l; } return -1; } public boolean teckcheck(int button, int cdir, TechData td) { return teckcheck(button, cdir, td, null); } public boolean teckcheck(int button, int cdir, TechData td, String key) { boolean usekey = key != null; if(usekey) { if(!key.equals(td.key)) return false; if(button != td.button && td.button != 0) return false; } else if(button != td.button && td.button != 0 || (state & td.states) == 0) return false; if(td.cursor >= 0 && td.cursor != cdir) return false; if(MP < td.mp) return false; if(!usekey && (td.requires & 0x800) != 0) return false; if((td.requires & 2) != 0 && time > turntime) return false; if((td.requires & 0x20) != 0 && time > jumptoptime) return false; if((td.requires & 4) != 0 && time > dashontime) return false; if((td.requires & 0x200) != 0 && time > landtime) return false; if((td.requires & 0x40) != 0 && (time < keyedtime + 700 || state != 1)) return false; if((td.requires & 0x80) != 0 && time < dashontime + 1400) return false; if((td.requires & 0x10) != 0 && v.x * v.x + v.z * v.z > 0.0001F) return false; if((td.requires & 0x400) != 0 && !finishhit) return false; if((td.requires & 0x1000) != 0) return false; if((td.requires & 0x20000) != 0) return false; if((td.requires & 0x10000) != 0) return false; if((td.requires & 8) != 0) { if(currenttech == null) return false; if(!currenttech.data.combotech || comboidx < currenttech.data.scp.length - 1) return false; } if((td.requires & 0x8000) != 0 && voltagelv < 3) return false; if((td.requires & 0x4000) != 0 && voltagelv < 2) return false; if((td.requires & 0x2000) != 0 && voltagelv < 1) return false; if(td.combotech && currenttech != null && !currenttech.data.combotech) return false; if(td.checkability && td.checktype != 255 && !applyStatusModifier(49, td.checktype, null)) return false; if(td.timelimit > 0 && skilltimelimits != null) { Object o = skilltimelimits.get((new StringBuilder(String.valueOf(td.techset))).append(td.scp[0]).toString()); if((o instanceof Long) && (long)stage.getTime() < ((Long)o).longValue()) return false; } return true; } public int getItemTech(int button) { if(wpstock[0] == 0) return -1; WeaponData _wp = GameSetting.getSetting().getWeapon(wpstock[0]); int num = _wp.tec.length; for(int l = 0; l < num; l++) if(teckcheck(button, -1, _wp.tec[l])) return l; return -1; } public int getTech(int button, int req) { return getTech(button, req, null); } public int getTech(int button, int req, String attr) { for(int l = psd.tecnum - 1; l >= 0; l--) { StagePlayerData.Tech t = psd.tec[l]; TechData td = t.data; if(button != -1 && (button != td.button && td.button != 0 || (state & td.states) == 0) || MP < td.mp || td.checkability && td.checktype != 255 && !applyStatusModifier(49, td.checktype, null)) continue; if(td.timelimit > 0 && skilltimelimits != null) { Object o = skilltimelimits.get((new StringBuilder(String.valueOf(td.techset))).append(td.scp[0]).toString()); if((o instanceof Long) && (long)stage.getTime() < ((Long)o).longValue()) continue; } if((td.requires & req) != 0 && (!KotoriUtil.isNotEmpty(attr) || attr.equals(td.scp[0]))) return l; } return -1; } public int getDeadAttack() { for(int l = psd.tecnum - 1; l >= 0; l--) { StagePlayerData.Tech t = psd.tec[l]; TechData td = t.data; if(MP >= td.mp && (td.requires & 0x40000) != 0) return l; } return -1; } public int getChargeAttack(int button) { if(stage.isTeamStreetfightMode() && battleoff) return -1; for(int l = psd.tecnum - 1; l >= 0; l--) { StagePlayerData.Tech t = psd.tec[l]; TechData td = t.data; if(button != td.button || MP < td.mp || td.checkability && td.checktype != 255 && !applyStatusModifier(49, td.checktype, null)) continue; if(td.timelimit > 0 && skilltimelimits != null) { Object o = skilltimelimits.get((new StringBuilder(String.valueOf(td.techset))).append(td.scp[0]).toString()); if((o instanceof Long) && (long)stage.getTime() < ((Long)o).longValue()) continue; } if((td.requires & 0x800) != 0) return l; } return -1; } public Quaternion getAttackDDir() { return q_1.set(1.0F, 0.0F, 0.0F, 0.0F); } public Attack attack(Vector3D lpos, AttackParam ap, AttackParam expap) { return attack(lpos, ap, expap, 0); } public Attack attack(Vector3D lpos, AttackParam ap, AttackParam expap, int flags) { if(battleoff) return null; StagePlayerData.Tech t = ap.tech != null ? ap.tech : currenttech; if(t != null && t.data != null) { TechData td = t.data; ap = (AttackParam)ap.clone(); float _p = pow * td.strrate + 1.0F * (1.0F - td.strrate); _p *= tpow * td.tecrate + 1.0F * (1.0F - td.tecrate); ap.damage *= (float)td.damage * _p; ap.damage *= (float)(100 + psd.lvAttackPower) * 0.01F; ap.groggydamage *= td.groggydamage <= 0 ? td.damage : td.groggydamage; ap.hitlv = ap.savehitlv == -1 ? hitlv : ap.savehitlv; ap.hitstop = hitstop; ap.hitscp_ok = hitscp_ok; ap.hitscp_guarded = hitscp_guarded; ap.hitscp_air = hitscp_air; ap.hitscp_emptyMP = hitscp_emptyMP; ap.button = td.button; int ab_attr = 0; if(t.src instanceof StyleData) ab_attr = psd.abilityVal(87); ap.attr = ap.attr == 0 ? td.attr == 0 ? ab_attr == 0 ? psd.baseattr : ab_attr : td.attr : ap.attr; ap.ignoreguard |= td.ignoreguard; ap.tech = t; applyStatusModifier(4, lastattackflags, ap); applyStatusModifier(71, lastattackflags, ap); } else { ap = (AttackParam)ap.clone(); ap.hitlv = ap.savehitlv == -1 ? hitlv : ap.savehitlv; ap.hitscp_ok = hitscp_ok; ap.hitscp_guarded = hitscp_guarded; ap.hitscp_air = hitscp_air; ap.hitscp_emptyMP = hitscp_emptyMP; } return super.attack(lpos, ap, expap, flags); } public Attack attackWithoutTech(Vector3D lpos, AttackParam ap, AttackParam expap) { if(battleoff) { return null; } else { ap = (AttackParam)ap.clone(); ap.hitlv = hitlv; ap.hitstop = hitstop; ap.hitscp_ok = hitscp_ok; ap.hitscp_guarded = hitscp_guarded; ap.hitscp_air = hitscp_air; ap.hitscp_emptyMP = hitscp_emptyMP; return super.attack(lpos, ap, expap, 0); } } public Attack attackWithoutTechAdjustDamage(Vector3D lpos, AttackParam ap, AttackParam expap) { if(battleoff) { return null; } else { ap = (AttackParam)ap.clone(); ap.damage *= pow; ap.damage *= (float)(100 + psd.lvAttackPower) * 0.01F; ap.hitlv = hitlv; ap.hitstop = hitstop; ap.hitscp_ok = hitscp_ok; ap.hitscp_guarded = hitscp_guarded; ap.hitscp_air = hitscp_air; ap.hitscp_emptyMP = hitscp_emptyMP; applyStatusModifier(4, lastattackflags, ap); applyStatusModifier(71, lastattackflags, ap); return super.attack(lpos, ap, expap, 0); } } public boolean giveDamage(AttackParam ap, Vector3D q, Vector3D w, AmpedModel attacker) { int stat = 0; if(HP <= 0) return false; if(holder != null) return false; int teamattack; if((teamattack = getTeamAttack(attacker)) == 3 && !ap.teamattack) return false; if(ap.downattack) { if(time > avoidattacktime || avoidattacktype != 1) return false; } else if(time < avoidattacktime) return false; if((attacker instanceof ItemModel) && getGroup() == -1) return false; if(ap.itemteamatkcheck && (attacker instanceof ItemModel)) { AmpedModel am = stage.getModel(((ItemModel)attacker).parentid); if(am != null) { if(getID() == am.getID()) return false; if(getTeamAttack(am) == 3 && !ap.teamattack) return false; } } if(ap.isJewelAttack()) { if(!stage.isDungeonMode()) return false; if(getGroup() != attacker.getGroup() && (psd.monstertype & 0x40) == 0) return false; } if(!stage.isServer()) return true; float dmgrate = 1.0F; int hsflag = 0; String hs = ap.hitscp == null ? "hit_b0" : ap.hitscp; int addvol = 8; if(HP >= 750) addvol >>= 1; else if(HP >= 500) addvol = (addvol * 2) / 3; else if(HP >= 250) addvol = addvol * 3 >> 2; boolean teamwork = false; int logflags = 0; if(attacker instanceof PlayerModel) { logflags = 0; PlayerModel pattacker = (PlayerModel)attacker; if(pattacker.currenttech != null) logflags = pattacker.getPlayerLogFlags(pattacker.currenttech.data); if(HP <= 250) logflags |= 0x8000; if(voltagelv >= 3) logflags |= 0x20000; if(isGroggy()) logflags |= 0x20; if(teamattack != 0) { logflags |= 0x80000; teamwork = psd.hasAbility(15) || pattacker.psd.hasAbility(15); } if(ap.downattack) logflags |= 0x400000; } if(stat == 0 && flowflag) { stat = 6; flowdmgcombo = Math.min(flowdmgcombo + 1, 10); } else { flowdmgcombo = 0; if(state == 272) dmgrate *= 1.2F; } int flag[] = { (info.holdcancel ? 1 : 0) | (info.holdthrough ? 2 : 0) }; applyStatusModifier(47, 3, flag); int bk = (int)(KMath.getVec(dir, 0.0F, v3_1).dot(v3_2.set(w.x, 0.0F, w.z).normalize()) * 4F) + 4; if(processTutorialAttacked(attacker)) { stat = 7; dmgrate = 0.0F; } else if(ap.attr == 7 && (flag[0] & 1) != 0 && (flag[0] & 2) == 0) stat = 5; else if(ap.isJewelAttack() && getGroup() == attacker.getGroup()) stat = 8; else if(ap.ignoreguard && damagerate != -2) { applyStatusModifier(5, logflags, ((Object) (new Object[] { guardp.init(this, 0, ap), ap }))); if(ctr instanceof AiController) ((AiController)ctr).getDamageAction(attacker, ap, w); dmgrate = guardp.dmgrate; } else if(ctr instanceof AiController) { guardCheck(guardp.init(this, bk, ap), logflags, ap); if(guardp.stat == 10) { stat = guardp.stat; dmgrate = guardp.dmgrate; } else { int ag = ((AiController)ctr).getDamageAction(attacker, ap, w); if(ag != 0) { stat = ag; dmgrate = 1.0F; } } } else if(stat == 0 || autoguard && ctr == null) { guardCheck(guardp.init(this, bk, ap), logflags, ap); stat = guardp.stat; dmgrate = guardp.dmgrate; } if(stat == 10) { int i = psd.tecIndexOf(currenttech); if(i >= 0) { avoidAttack(200); if(ctr instanceof AiController) { int tid = ((AiController)ctr).target() == null ? -1 : ((AiController)ctr).target().getID(); sendEvent(PlayerAttackEvent.create(this, 128, i, ++comboidx, 0, 0, 0, 0, tid)); } else { sendEvent(PlayerAttackEvent.create(this, 40, i, ++comboidx, 0, 0, 0, 0)); } return true; } stat = 0; } Object method[] = { new String() }; if(stat != 5 && stat != 7 && stat != 8 && applyStatusModifier(80, ap.attr, ((Object) (method))) && (method[0] instanceof String)) { String attr = (String)method[0]; int i = getTech(-1, 0x10000, attr); if(i >= 0) { getAttackPos(i_1); sendEvent(PlayerAttackEvent.create(this, 40, i, 0, 0, i_1[0], i_1[1], i_1[2])); return true; } } if((attacker instanceof PlayerModel) && stat != 8) { if(stage.isVersusMonsterMode()) { PlayerModel pattacker = (PlayerModel)attacker; ap = (AttackParam)ap.clone(); pattacker.applyStatusModifier(25, psd.monstertype, ((Object) (new Object[] { ap, Integer.valueOf(psd.level), Integer.valueOf(stage.currentepkind) }))); applyStatusModifier(26, pattacker.psd.monstertype, ((Object) (new Object[] { guardp.init(this, 0, ap), Integer.valueOf(pattacker.level), Integer.valueOf(stage.currentepkind) }))); pattacker.applyStatusModifier(28, 0, ap); if(ap.button == 10) pattacker.applyStatusModifier(4, 1024, ap); dmgrate *= guardp.dmgrate; } if(psd.attrdef != null && ap.attr >= 1 && ap.attr <= psd.attrdef.length) dmgrate *= (float)psd.attrdef[ap.attr - 1] / 100F; } if(stat == 0 && isGroggy() && ap.groggydamage > 0.0F) if(attacker instanceof PlayerModel) { StagePlayerData.Tech t = ((PlayerModel)attacker).currenttech; if(t == null || t.data == null || !t.data.combotech) { stat = 1; } else { dmgrate *= 0.6F; accumdmgresettime = time + 1500; accumdmg += ap.groggydamage; } } else { stat = 1; } if(attackedtime > 0 && time < attackedtime + 300) contdmgrate *= contdef; else contdmgrate = 1.0F; dmgrate *= contdmgrate; boolean isdown = false; float grgdmg = ap.groggydamage; int hefx = ap.hitefx; switch(stat) { case 1: // '\001' hsflag = 2; accumdmg = 0.0F; setGroggy(false); isdown = true; break; case 5: // '\005' float abilityrate = 0.0F; if(attacker instanceof PlayerModel) abilityrate = (float)((PlayerModel)attacker).psd.sumAbility(86) * 0.01F; dmgrate *= psd.guardrate; dmgrate += (1.0F - dmgrate) * ap.guarddmgrate; dmgrate += (1.0F - dmgrate) * abilityrate; hsflag = 5; accumdmg = Math.min(accumdmg, groggylimit - 1.0F); break; case 6: // '\006' dmgrate *= Math.max(0.2F, 1.7F / (float)(flowdmgcombo + 1)); hsflag = 4; isdown = true; break; case 7: // '\007' dmgrate *= 0.0F; hsflag = 7; accumdmg = Math.min(accumdmg, groggylimit - 1.0F); if(psd.sumAbility(22) > 0 && teamattack == 0) { int hp = psd.sumAbility(22); if(stage.getStageMode() == 27) hp /= 2; BasicAmpedEvent e = BasicAmpedEvent.create(getID(), 34, HP + hp); stage.sendEvent(e); } break; case 8: // '\b' hs = "hit_nop"; dmgrate = 0.0F; hefx = 70; removeStatusModifierType(60); switch(ap.attr) { case 20: // '\024' hefx = 71; cureConfusion(attacker.getID()); break; case 21: // '\025' hefx = 72; removeStatusModifierType(61); cureConfusion(attacker.getID()); break; } break; case 2: // '\002' case 3: // '\003' case 4: // '\004' default: if(time > accumdmgresettime) accumdmg = 0.0F; accumdmgresettime = time + 1500; accumdmg += ap.groggydamage; if(info.isDownHit(hs, 0)) { hsflag = 2; dmgrate *= 0.8F; accumdmg = 0.0F; isdown = true; } else { dmgrate *= 0.7F; } if(accumdmg >= groggylimit) hsflag = 6; break; } if(teamattack == 1) dmgrate *= 0.5F; else if(teamattack >= 2) dmgrate *= 0.3F; if(teamwork) dmgrate *= 0.5F; if(battleoff) dmgrate = 0.0F; float abilityrate[] = new float[1]; if(stat != 5 && stat != 7 && applyStatusModifier(81, ap.attr, abilityrate)) dmgrate *= abilityrate[0]; if((attacker instanceof PlayerModel) && !((PlayerModel)attacker).isNPC()) { StyleData style = GameSetting.getSetting().getStyle(((PlayerModel)attacker).psd.style); if(style != null && applyStatusModifier(96, style.sex, abilityrate)) dmgrate *= abilityrate[0]; } if(attacker instanceof PlayerModel) { StagePlayerData.Tech t = ((PlayerModel)attacker).currenttech; if(t != null && t.data != null && ((PlayerModel)attacker).applyStatusModifier(97, t.data.checkability ? 1 : 0, abilityrate)) dmgrate *= abilityrate[0]; } if(ap.attr == 10) { def = mapval(0, defmap) * 0.9F; contdef = mapval(psd.DEF, contdefmap); change_def = true; } float def_t = def; if(ap.attr == 9) { def_t = mapval(0, defmap) * 0.9F; dmgrate = 1.0F; } switch(damageratetype) { default: break; case 2: // '\002' if(damagerate >= 0 && bk < 3) dmgrate *= (float)damagerate * 0.01F; else if(damagerate == -2) dmgrate = 0.0F; // fall through case 1: // '\001' if(damagerate >= 0 && isDefent(hsflag)) { dmgrate *= (float)damagerate * 0.01F; break; } if(damagerate == -2) dmgrate = 0.0F; break; } int dmg = (int)(ap.damage * dmgrate * def_t * 10F); if((attacker instanceof PlayerModel) && ap.attr == 14) if(stage.isGuardianMode() && !isResistInstantDeath()) { if(Math.random() * 1000D < (double)((PlayerModel)attacker).psd.sumAbility(62)) { dmg = HP; grgdmg = 1.0F; hefx = 63; } } else { hs = "hit_nop"; hefx = 64; } int prevSharedHP = -1; int sharedHP = -1; if(!HPshare) { dmg = Math.min(dmg, HP); HP = Math.max(HP - dmg, !isDefent(hsflag) && (grgdmg != 0.0F || ap.nogroggydie) ? 0 : 10); } else if(stage.isDungeonMode()) { prevSharedHP = ((DungeonRule)stage.rule).getSharedHP(); dmg = Math.min(dmg, prevSharedHP); sharedHP = Math.max(prevSharedHP - dmg, !isDefent(hsflag) && (grgdmg != 0.0F || ap.nogroggydie) ? 0 : 10); } if(HP == 0 || HPshare && sharedHP == 0) { isdown = true; if(userinfo.hasSkill(207) && hsflag != 2 && hsflag != 4 && !hasGuts()) { isdown = false; hsflag = 6; if(!HPshare) HP = 10; else sharedHP = 10; } else if(hasGuts()) { hsflag = 2; avoidAttack(1500, 0); if(!HPshare) { int sethp = 100; if(stage.getStageMode() == 27) sethp /= 2; HP = sethp; decGuts(); } else if(gutsnum > 0) { sharedHP = 100; gutsnum--; } } else { hsflag = 3; rec.deadtime = stage.getTime() - stage.countdownstart; rec.diept++; } } rec.dmgpt += dmg; boolean changebase = false; boolean changeinfo = false; PlayerScriptInfo oldinfo = null; switch(hittype) { case 2: // '\002' if(bk >= 4) break; // fall through case 1: // '\001' oldinfo = info; GameSetting set = GameSetting.getSetting(); if(hitkind < set.scpinfo.length && set.scpinfo[hitkind] != null) info = set.scpinfo[hitkind]; break; default: changebase = hittype != 0 ? false : applyStatusModifier(47, 0, hs); changeinfo = hittype != 0 ? false : applyStatusModifier(46, 0, hs); break; } hs = info.getHitScript(hs, hsflag); if(changeinfo) applyStatusModifier(46, 1, null); if(changebase) applyStatusModifier(47, 1, null); if(hittype != 0 && oldinfo != null) info = oldinfo; if(releaseCarryItem(ap.damage * (stat != 5 && stat != 7 && stat != 8 ? 1.0F : dmgrate), hsflag, hs, !(attacker instanceof PlayerModel) || !ap.takecarryitem ? null : (PlayerModel)attacker)) { burnUpCarryItem(v3_1.set(0.0F, 0.0F, 0.0F)); pos.y += colbndbody.y; hs = "hit_bc"; hs = info.getHitScript(hs, hsflag); } int hitscp; if("guard0".equals(hs) || "guard1".equals(hs)) hitscp = getKMethodID(hs, true); else hitscp = getKMethodID(hs); if(hitscp < 0) hitscp = getKMethodID("hit_b0"); if(attacker instanceof PlayerModel) { logflags = 0; PlayerModel pattacker = (PlayerModel)attacker; if(pattacker.currenttech != null) logflags = getPlayerLogFlags(pattacker.currenttech.data); if(HP <= 0) logflags |= 6; if(pattacker.HP <= 250) logflags |= 0x8000; if(isdown) logflags |= 2; addPlayerLog(300, dmg, logflags); pattacker.addPlayerLog(100, dmg, logflags); } sendLock(); if(isdown && !ap.noadjustdir) v3_2.set(w).add((float)Math.random() * 0.2F, 0.0F, (float)Math.random() * 0.2F).normalize(); else v3_2.set(w); PlayerAttackedEvent e; if(hs.equals("hit_nop")) { hitscp = 32768; if(hsflag == 6) { if(dmg == 0) hsflag = -1; } else { hsflag = dmg != 0 ? 0 : -1; } if((ctr instanceof AiController) && currenttech == null) ((AiController)ctr).noDamageAction(); } else if(hs.equals("trap_script")) { e = PlayerScriptEvent.create(this, hitscp, attacker.getID(), null); sendEvent(e); return true; } if(ap.downattack) avoidAttack(100); else avoidAttack(10); if(isDefent(hsflag)) { guardOn(lastguard); avoidAttack(60); } e = PlayerAttackedEvent.create(this, 42, HP, attacker.getID(), hitscp, v3_2, v3_1.set(q).sub(pos), hefx, hsflag, flowdmgcombo); switch(ap.attr) { case 23: // '\027' e.id = 166; e.flags = 1; e.x_add = KMath.quantize(attacker.pos.x, 1000F); e.y_add = KMath.quantize(attacker.pos.y, 500F); e.z_add = KMath.quantize(attacker.pos.z, 1000F); break; } sendEvent(e); attacker.attackHit(this, ap, dmg, hs, hsflag); if(attacker != this && ap.damage > 0.0F) addVoltage(addvol); if(HPshare) stage.processStageRule(2, teamattack != 1 ? ((Object) (attacker)) : null, ((Object) (new Object[] { this, new Integer(prevSharedHP - sharedHP) }))); else if(HP == 0) stage.processStageRule(0, teamattack != 1 ? ((Object) (attacker)) : null, this); else stage.processStageRule(1, teamattack != 1 ? ((Object) (attacker)) : null, this); recentAttacker = teamattack != 1 ? attacker : null; applyStatusModifier(38, 2, Integer.valueOf(ap.attr)); if(ctr instanceof AiController) ((AiController)ctr).getAttacked(); return true; } protected void cureConfusion(int attackerid) { if(isConfusion() && stage.isServer()) { int scpid = getKMethodID("hit_nop"); if(scpid != 0) { PlayerScriptEvent e = PlayerScriptEvent.create(this, scpid, attackerid, null); sendEvent(e); } } } private boolean processTutorialAttacked(AmpedModel am) { if(!GameSetting.getSetting().istutorialbuttoncheck) return false; GetAmped2 ga2 = GetAmped2.getAmped2(); if(ga2 == null) return false; if(!(ga2.getStageConnector() instanceof StageConnector.EventScene)) return false; if(!((StageConnector.EventScene)ga2.getStageConnector()).isTutorial()) return false; if(!isNPC()) return false; NPCInfo npc = GameSetting.getSetting().getNPCInfo(getNPCID()); if(npc == null) return false; if(!(am instanceof PlayerModel)) return false; PlayerModel pm = (PlayerModel)am; if(pm.currenttech == null || pm.currenttech.data == null) return false; int atkbutton = pm.currenttech.data.button; int atkstate = pm.currenttech.data.states; int atkrequires = pm.currenttech.data.requires; System.out.println((new StringBuilder(String.valueOf(atkbutton))).append("/").append(npc.weakbutton).toString()); return npc.weakbutton != 0 && atkbutton > 0 && (npc.weakbutton & 1 << atkbutton - 1) == 0 || npc.weakstates != 0 && (npc.weakstates & atkstate) == 0 || npc.weakrequires != 0 && (npc.weakrequires & atkrequires) == 0; } public void kill(boolean notifyRule) { if(!stage.isServer()) return; if(isDead()) return; int damage = HP; HP = 0; flowdmgcombo = 0; rec.deadtime = stage.getTime() - stage.countdownstart; rec.diept++; if(holder == null) { int hsflag = 3; String hs = "hit_bd"; float carryItemDamage = 1000F; if(vehicle != null) carryItemDamage = vehicle.HP; if(releaseCarryItem(carryItemDamage, hsflag, hs)) { burnUpCarryItem(v3_1.set(0.0F, 0.0F, 0.0F)); pos.y += colbndbody.y; hs = "hit_bc"; } hs = info.getHitScript(hs, hsflag); int hitscp = getKMethodID(hs); v3_2.set(0.0F, 0.0F, -1F); rot.transform(v3_2); v3_1.set(v3_2).scale(-0.05F); sendLock(); avoidAttack(100); PlayerAttackedEvent e = PlayerAttackedEvent.create(this, 42, HP, getID(), hitscp, v3_2, v3_1, -1, hsflag, flowdmgcombo); sendEvent(e); } else { BasicAmpedEvent e = BasicAmpedEvent.create(getID(), 51, HP); sendEvent(e); } if(notifyRule) if(HPshare) stage.processStageRule(2, null, ((Object) (new Object[] { this, new Integer(damage) }))); else if(HP == 0) stage.processStageRule(0, null, this); else stage.processStageRule(1, null, this); recentAttacker = null; } public boolean isResistInstantDeath() { return boss || (psd.monstertype & 0x20) != 0; } public void dropHit() { readyDropGem(); if(npcid == -1) { HitEffectData d = GameSetting.getSetting().getHitEffect(damagehitefx); damagehitefx = -1; if(d == null || d.gemnum == 0 && d.coinnum == 0) { dropStageItem(0, 0, 20, 0); dropStageItem(0, 0, 20, 0); } else { for(int l = 0; l < d.gemnum; l++) dropStageItem(0, 0, d.gemrate, 0); for(int l = 0; l < d.coinnum; l++) dropStageItem(1, 0, d.coinrate, 0); } } else { switch(NPCInfo.getWantedRank(npcid)) { case 2: // '\002' case 3: // '\003' case 4: // '\004' case 5: // '\005' case 6: // '\006' dropStageItem(0, 0, 20, 0); // fall through case 0: // '\0' case 1: // '\001' dropStageItem(0, 0, 20, 0); break; } } } public void dropHitWall() { readyDropGem(); if(npcid == -1) { dropStageItem(0, 0, 100, 0); dropStageItem(0, 0, 50, 0); } else { switch(NPCInfo.getWantedRank(npcid)) { case 2: // '\002' case 3: // '\003' case 4: // '\004' case 5: // '\005' case 6: // '\006' dropStageItem(0, 0, 50, 0); // fall through case 0: // '\0' case 1: // '\001' dropStageItem(0, 0, 100, 0); break; } } } public void dropHitDown() { readyDropGem(); if(npcid == -1) { HitEffectData d = GameSetting.getSetting().getHitEffect(damagehitefx); damagehitefx = -1; if(d == null || d.gemnum == 0 && d.coinnum == 0) { dropStageItem(0, 0, 100, 0); dropStageItem(0, 0, 50, 0); } else { for(int l = 0; l < d.gemnum; l++) dropStageItem(0, 0, d.gemrate, 0); for(int l = 0; l < d.coinnum; l++) dropStageItem(1, 0, d.coinrate, 0); } } else { switch(NPCInfo.getWantedRank(npcid)) { case 4: // '\004' case 5: // '\005' case 6: // '\006' dropStageItem(0, 1 + KMath.rndi(2), 50, 0); // fall through case 2: // '\002' case 3: // '\003' dropStageItem(0, 0, 50, 0); // fall through case 0: // '\0' case 1: // '\001' dropStageItem(0, 0, 100, 0); break; default: dropStageItem(0, 0, 25, 0); break; } } } public void dropHitDie() { readyDropGem(); if(npcid == -1) { dropStageItem(1, 1, 100, 0); dropStageItem(0, KMath.rndi(3), 100, 0); dropStageItem(0, KMath.rndi(3), 100, 0); dropStageItem(0, KMath.rndi(2), 50, 0); dropStageItem(0, KMath.rndi(2), 50, 0); dropStageItem(0, KMath.rndi(2), 50, 0); } else { switch(NPCInfo.getWantedRank(npcid)) { case 4: // '\004' case 5: // '\005' case 6: // '\006' dropStageItem(1, 1, 100, 0); dropStageItem(1, 1, 100, 0); dropStageItem(1, 1, 40, 0); dropStageItem(1, 1, 20, 0); dropStageItem(0, 2, 100, 0); dropStageItem(0, 1, 100, 0); dropStageItem(0, 0, 100, 0); dropStageItem(0, 0, 100, 0); dropStageItem(0, KMath.rndi(3), 50, 0); dropStageItem(0, KMath.rndi(3), 50, 0); dropStageItem(0, KMath.rndi(3), 50, 0); break; case 2: // '\002' case 3: // '\003' dropStageItem(1, 1, 100, 0); dropStageItem(0, 0, 100, 0); dropStageItem(0, 0, 100, 0); dropStageItem(0, 3, 100, 0); dropStageItem(0, KMath.rndi(2), 50, 0); dropStageItem(0, KMath.rndi(2), 50, 0); break; case 0: // '\0' case 1: // '\001' dropStageItem(0, 0, 100, 0); dropStageItem(0, 0, 50, 0); break; default: dropStageItem(); break; } } } public boolean dropStageItem() { if(dropItemInfo == null) return true; if(dropItemInfo.rare > 1.0F) { if(ctr instanceof AiController) { AiController ai = (AiController)ctr; if((float)(ai.getTime() - ai.getStartTime()) > dropItemInfo.rare * 1000F) return false; else return dropStageItem(dropItemInfo.typeid, dropItemInfo.subid, 0, 0); } else { return false; } } else { return dropStageItem(dropItemInfo.typeid, dropItemInfo.subid, (int)(100F * dropItemInfo.rare), 0); } } public void guardCheck(GuardParam gp, int flags, AttackParam ap) { boolean vehicle_guard = vehicle != null ? GameSetting.getSetting().getVehicle(vehicle.vehicleid).guard : true; if(!vehicle_guard || isFeatureFlag(4)) return; if(currenttech != null && combomode == 1 && gp.bk < 3) { gp.stat = 10; return; } switch(guardtype) { case 1: // '\001' if(gp.bk >= 4 && !ap.checkdirdisable) break; if(!isFeatureFlag(8) && stage.getTime() - attacktime < pguardduration && stage.getTime() - attackedtime > 1000) gp.stat = 7; else gp.stat = 5; break; case 2: // '\002' if(!isFeatureFlag(8) && stage.getTime() - attacktime < pguardduration && stage.getTime() - attackedtime > 1000) gp.stat = 7; else gp.stat = 5; break; default: if(guardmode != 0 || gp.bk >= 4 && !ap.checkdirdisable || gp.ap.button != guardbutton || stage.getTime() >= guardtime || (state & 7) == 0) break; if(!isFeatureFlag(8) && stage.getTime() - attacktime < pguardduration && stage.getTime() - attackedtime > 1000 && !gp.ap.downattack) gp.stat = 7; else gp.stat = 5; break; } applyStatusModifier(5, flags, ((Object) (new Object[] { gp, ap }))); } public static boolean isDefent(int i) { return i == 5 || i == 7; } public static boolean isHoldThrough(AmpedModel am, AttackParam ap, int hsflag) { if(!(am instanceof PlayerModel)) return false; int flag[] = { ((PlayerModel)am).info.holdthrough ? 2 : 0 }; ((PlayerModel)am).applyStatusModifier(47, 3, flag); return ((flag[0] & 2) != 0 && !isDefent(hsflag) || ((PlayerModel)am).lastdamagerate == -2) && ap.attr == 7; } int getPlayerLogFlags(TechData td) { return td != null ? getPlayerLogFlags(td.button, td.states, td.requires) : 0; } int getPlayerLogFlags(int button, int states, int requires) { int logflags = 0; if((states & 8) != 0) logflags |= 0x10; if((states & 0x110) != 0) logflags |= 8; if((requires & 8) != 0) logflags |= 0x40; if((requires & 0x2000) != 0) logflags |= 0x80; if((requires & 0x8000) != 0) logflags |= 0x180; if((requires & 0x1000) != 0) logflags |= 0x40000; if(button == 5) logflags |= 0x80; if(button != 10) logflags |= 0x200; if((action instanceof PlayerActionBattle) && ((PlayerActionBattle)action).action == ((PlayerActionBattle)action).aimaction) logflags |= 0x100000; if((logflags & 0x80) == 0) logflags |= 0x200000; return logflags; } private void skillBerserker() { int killdope = psd.sumAbility(13); if(killdope > 0) { sendLock(); int rate = 100; if(npcid != -1) switch(NPCInfo.getWantedRank(npcid)) { case 0: // '\0' case 1: // '\001' rate = 50; break; case 2: // '\002' case 3: // '\003' rate = 80; break; case 4: // '\004' case 5: // '\005' case 6: // '\006' rate = 100; break; default: rate = 50; break; } AbilityData a = new AbilityData(); a.type = 30; a.val = (killdope * rate) / 100; sendEvent(StatusModifierEvent.create(this, nextModifierID(), a, 12)); } } private void skillVictoryHealing(PlayerModel target) { int v = psd.sumAbility(12); if(v > 0) { PlayerModel p = target; if(stage.rule instanceof MassBusterRule) v = (v * 5) / 100; else if(p.ctr instanceof AiController) v = (v * 30) / 100; else if(stage.getStageMode() == 27) v /= 2; BasicAmpedEvent e = BasicAmpedEvent.create(getID(), 34, HP + v); stage.sendEvent(e); } } public void attackHit(AmpedModel m, AttackParam ap, int damage, String hs, int hsflag) { if(isDead()) return; if(damage > 0) { rec.score += damage / 15; if(m != this && (m instanceof PlayerModel) && ((PlayerModel)m).parentid == -1 || getStage().getStageMode() != 18) rec.atkpt += damage; if(hsflag == 3) { if(stage != null && (stage.rule instanceof DogfightRule)) { if(!isNPC() && (m instanceof PlayerModel) && (PlayerModel)m != this && !((PlayerModel)m).isNPC()) rec.killpt++; } else if(stage != null && (stage.rule instanceof TeamDogfightRule)) { if(!isNPC() && (m instanceof PlayerModel) && (PlayerModel)m != this && !((PlayerModel)m).isNPC() && getGroup() != ((PlayerModel)m).getGroup()) rec.killpt++; } else { rec.killpt++; } skillBerserker(); } if(m != this && (m instanceof PlayerModel)) { if(getStage().rule instanceof DungeonRule) { DungeonRule drule = (DungeonRule)getStage().rule; drule.addAttackedExp(this, (PlayerModel)m, damage); } else if(getStage().rule instanceof CoreRule) { CoreRule crule = (CoreRule)getStage().rule; crule.addAttackedExp(this, (PlayerModel)m, damage); } if(currenttech != null && ap.tech == currenttech) { int nlv = glide.addGlidePoint(currenttech.data, hsflag); if(nlv > 0) { BasicAmpedEvent e = BasicAmpedEvent.create(getID(), 87, nlv); sendEvent(e); } if(atkvolup) addVoltage(5); } else if(atkvolup) addVoltage(2); atkvolup = false; } if((ctr instanceof AiController) && (m instanceof PlayerModel)) { AiController aictr = (AiController)ctr; int info = ((PlayerModel)m).getTeamAttack(this); if(info == 2) aictr.hitTeamAttack = true; } } if(hsflag == 3 && (m instanceof PlayerModel)) skillVictoryHealing((PlayerModel)m); if(ap.tech == null && ap.hitscp_ok != null && !scplocked && !isHoldThrough(m, ap, hsflag)) if(isDefent(hsflag)) { if(sendAttackHit(ap, ap.hitscp_guarded)) return; } else if((m instanceof PlayerModel) && (((PlayerModel)m).state & 0x110) != 0) { if(sendAttackHit(ap, ap.hitscp_air)) return; } else if((m instanceof PlayerModel) && ((PlayerModel)m).MP == 0) { if(sendAttackHit(ap, ap.hitscp_emptyMP)) return; } else if(sendAttackHit(ap, ap.hitscp_ok)) return; if(currenttech != null && ap.tech == currenttech && !scplocked) { if(!isHoldThrough(m, ap, hsflag)) if(isDefent(hsflag)) { if(sendAttackHit(ap, ap.hitscp_guarded)) return; } else if((m instanceof PlayerModel) && (((PlayerModel)m).state & 0x110) != 0) { if(sendAttackHit(ap, ap.hitscp_air)) return; } else if((m instanceof PlayerModel) && ((PlayerModel)m).MP == 0) { if(sendAttackHit(ap, ap.hitscp_emptyMP)) return; } else if(sendAttackHit(ap, ap.hitscp_ok)) return; if(ap.hitstop > 0) { scplocked = true; float prs = 0.0F; prs = (float)ap.hitstop * 0.005F; if(isDefent(hsflag)) prs += 0.18F; int sid; if((sid = getKMethodID("hitstop")) != 0) { PlayerAttackHitEvent e = PlayerAttackHitEvent.create(this, 45, sid, ap.hitstop, glide.hits, glide.time, prs); sendLock(); sendEvent(e); ap.hitlv = 0; ap.hitstop = 0; ap.hitscp_ok = ap.hitscp_guarded = ap.hitscp_air = ap.hitscp_emptyMP = null; } } else if(ap.hitlv >= 10) { scplocked = true; float prs = 0.0F; prs = (float)ap.hitlv * 0.005F; if(isDefent(hsflag)) prs += 0.18F; int sid; if((sid = getKMethodID((new StringBuilder("hit")).append(Math.min(1, ap.hitlv / 10 - 1)).toString())) != 0) { PlayerAttackHitEvent e = PlayerAttackHitEvent.create(this, 45, sid, ap.hitlv % 10, glide.hits, glide.time, prs); sendLock(); sendEvent(e); ap.hitlv = 0; ap.hitscp_ok = ap.hitscp_guarded = ap.hitscp_air = ap.hitscp_emptyMP = null; } } else { float prs = 0.0F; if(ap.constraint) prs = 0.03F + (float)ap.hitlv * 0.005F; if(isDefent(hsflag)) prs += 0.14F; PlayerAttackHitEvent e = PlayerAttackHitEvent.create(this, 45, 0, ap.hitlv % 10, glide.hits, glide.time, ap.nopressure ? 0.0F : prs); sendEvent(e); } } ap.damage *= 0.7F; ap.groggydamage *= 0.7F; } private boolean sendAttackHit(AttackParam ap, String s) { if(s == null) return false; int sid; int eid; if(attackingwpid != 0) { eid = 46; KMethod km = GameSetting.getSetting().getWeapon(attackingwpid).tec[0].getScriptModelData().kclass.getKMethod(s); if(km == null) return false; sid = attackingwpid << 16 | km.idx; } else { eid = 45; int ti = 0; KMethod km = null; if(currenttech != null) { ti = (currenttech.kmid[0] >>> 8) - info.basescp.length; km = tecscp[ti].getKClass().getKMethod(s); } if(km != null) sid = km.idx | 256 * (ti + info.basescp.length); else sid = getKMethodID(s); if(sid < 0) return false; } PlayerAttackHitEvent e = PlayerAttackHitEvent.create(this, eid, sid, 0, glide.hits, glide.time, 0.0F); sendLock(); sendEvent(e); ap.hitlv = 0; ap.hitstop = 0; ap.hitscp_ok = ap.hitscp_guarded = ap.hitscp_air = ap.hitscp_emptyMP = null; return true; } public StagePlayerData.Tech getCurrentTech() { return currenttech; } public void avoidAttack(int dt) { avoidAttack(dt, 0); } public void avoidAttack(int dt, int type) { avoidattacktime = time + dt; avoidattacktype = type; } public void setFlow(boolean b) { flowflag = b; if(b) downflag = false; } public boolean isFlowing() { return flowflag; } public void setDown(boolean b) { downflag = b; if(b) flowflag = false; } public boolean isDown() { return downflag; } public boolean isFirstAttack() { return currenttech != null && comboidx <= 1; } public int getTeamAttack(AmpedModel m) { if(getGroup() == -1) return 3; boolean imnpc = ctr instanceof AiController; boolean misnpc = !(m instanceof PlayerModel) || (((PlayerModel)m).ctr instanceof AiController); boolean training = stage.isTournamentTrainingMode(); if(!training && (imnpc || misnpc) && getGroup() == m.getGroup() && getGroup() != 0) return 3; if(getGroup() == m.getGroup() && getGroup() != 0) { if(misnpc && !training) return 2; return stage.getStageMode() != 7 && stage.getStageMode() != 20 && stage.getStageMode() != 26 ? 1 : 3; } return getGroup() != 4 || m.getGroup() != 0 ? 0 : 3; } void setGroggy(boolean b) { if(b) { if(groggytime == 0) groggyStateChanged(true); groggytime = 2000; } else { if(groggytime > 0) groggyStateChanged(false); groggytime = 0; } } void updateGroggy(int dt) { if(groggytime > 0 && (groggytime = Math.max(0, groggytime - dt)) == 0) if(getRunningKFrame() == null) { accumdmg = 0.0F; groggyStateChanged(false); } else { groggytime = 1; } } public boolean isGroggy() { return groggytime > 0; } void groggyStateChanged(boolean flag) { } public void addVoltage(int val) { if(ctr instanceof AiController) return; if(val > 0) addVoltageAbs((val * 10 * voltagerate) / 100); else addVoltageAbs(val * 10); } public void addVoltageAbs(int val) { if(!stage.isServer()) { return; } else { voltageval = KMath.clamp(voltageval + val, 0, 1000); return; } } void updateVoltage(int dt, boolean force) { if(!stage.isServer()) return; if(!force) { if(isDead()) return; if(kframe != null) { voltiming = time + 150; return; } if(voltiming > time) return; } voltagetime -= dt; if(voltagetime <= 0 && voltagelv >= 3) voltageval = 400; int newlv; if(voltageval == 1000) newlv = 3; else if(voltageval >= 600) newlv = 2; else if(voltageval >= 300) newlv = 1; else newlv = 0; if(newlv != voltagelv) { sendEvent(BasicAmpedEvent.create(getID(), 75, newlv)); voltagetime = 12000; } } void voltageStateChanged(int oldvol, int voltage) { boolean update = false; int arg[] = { oldvol, voltage }; update |= applyStatusModifier(30, 0x20000, arg); update |= applyStatusModifier(31, 0x20000, arg); update |= applyStatusModifier(32, 0x20000, arg); update |= applyStatusModifier(33, 0x20000, arg); update |= applyStatusModifier(34, 0x20000, arg); if(update) updateStatus(); } public int getVoltageLevel() { return voltagelv; } void updateGlideCombo(int dt) { if(!stage.isServer() || glide.time <= 0) return; if((glide.time = Math.max(0, glide.time - dt)) == 0) glide.finishGlideCombo(this); } float getMPRate() { return Math.max(0.0F, (1.0F * (float)(mpusingrate + getStatusModifierValue(85))) / 100F); } public boolean getStageItem(ga2.stage.atk.StageItem.Context sictx) { if(stage.rule instanceof ArcadeScene.ArcadeTaskChain.ArcadeRule) { if(ctr instanceof AiController) return false; } else if(npcid >= 0) return false; if(ctr == null) return true; switch(sictx.type) { case 4: // '\004' sendEvent(BasicAmpedEvent.create(getID(), 34, HP + 100)); // fall through case 0: // '\0' case 1: // '\001' case 30: // '\036' sendEvent(BasicAmpedEvent.create(getID(), 141, sictx.subid)); break; case 2: // '\002' sendEvent(BasicAmpedEvent.create(getID(), 36, sictx.subid)); break; default: return false; } return true; } public void holdTarget(boolean b) { if(b) { if(battleoff) return; AmpedModel m = stage.getModel(holdtarget); if(m instanceof PlayerModel) { PlayerModel pm = (PlayerModel)m; int flag[] = { (pm.info.holdcancel ? 1 : 0) | (pm.info.holdthrough ? 2 : 0) }; pm.applyStatusModifier(47, 3, flag); if((flag[0] & 1) != 0 || (flag[0] & 2) != 0 || pm.lastdamagerate == -2) return; pm.holder = this; pm.holding = null; holding = pm; holder = null; pm.releaseCarryItem(1.0F, 2, "dummy"); } } else if(holding != null) { if(holding.holder == this) { if(holdreleasescp != null) { holding.applyStatusModifier(47, 2, holdreleasescp); holding.applyStatusModifier(46, 2, holdreleasescp); } holding.holdRecovered(); holding.holder = null; if(holdreleasescp != null) { holding.startScript(holdreleasescp); holdreleasescp = null; } else { holding.recoverPlayer(); } } holding = null; } } public void holdRecovered() { pos.set(holder.pos); Vector3D vv = (new Vector3D()).set(holder.holdreleasepos).transform(holder.mat).sub(pos); updateMatrix(); updateBounds(); Polygon p[] = stage.getStagePolygons(envbox, vv); vv.scale(0.5F); move(vv, 1.0F, p); updateBounds(); move(vv, 1.0F, p); updateMatrix(); updateBounds(); } public void holdReleasePos(Vector3D v) { holdreleasepos.set(v); } public void holdPosition(int i, Vector3D vector3d, Quaternion quaternion, boolean flag) { } public void holdStartScript(String s) { if(holding != null) if(holding.holder == this) holding.startScript(s); else holding = null; } public void holdStartKGLScript(String s) { if(holding != null && (holding instanceof PlayerViewModel)) if(holding.holder == this) ((PlayerViewModel)holding).getScriptModel().startScript(s); else holding = null; } public void holdReleaseScript(String s) { holdreleasescp = s; } public void holdSetMotion(String s1) { } public void holdAnime(float f1, float f2) { } public void holdGiveDamage(float d, boolean finish) { if(!stage.isServer()) return; if(currenttech == null || holding == null || holding.isDead()) return; int teamattack; if((teamattack = holding.getTeamAttack(this)) == 3) return; boolean disable_def = false; if(d == 0.0F) { disable_def = true; d = 1.0F; } if(battleoff) d = 0.0F; TechData td = currenttech.data; float _p = pow * td.strrate + 1.0F * (1.0F - td.strrate); _p *= tpow * td.tecrate + 1.0F * (1.0F - td.tecrate); d *= (float)td.damage * _p; if(stage.isVersusMonsterMode()) { AttackParam ap = new BasicAttack(); ap.damage = d; applyStatusModifier(25, holding.psd.monstertype, ((Object) (new Object[] { ap, Integer.valueOf(holding.psd.level), Integer.valueOf(stage.currentepkind) }))); holding.applyStatusModifier(26, psd.monstertype, ((Object) (new Object[] { guardp.init(this, 0, ap), Integer.valueOf(psd.level), Integer.valueOf(stage.currentepkind) }))); d = ap.damage; d *= guardp.dmgrate; } if(teamattack == 1) d *= 0.5F; else if(teamattack == 2) d *= 0.3F; if(!isNPC()) { float abilityrate[] = new float[1]; StyleData style = GameSetting.getSetting().getStyle(psd.style); if(style != null && holding.applyStatusModifier(96, style.sex, abilityrate)) d *= abilityrate[0]; } float def_t = disable_def ? mapval(0, defmap) * 0.9F : holding.def; int dmg = (int)(d * def_t * 10F); if(!holding.HPshare) holding.HP = Math.max(holding.HP - dmg, finish ? 0 : 10); int logflags = 0; PlayerModel pattacker = this; if(pattacker.currenttech != null) logflags = getPlayerLogFlags(pattacker.currenttech.data); if(holding.HP <= 0) logflags |= 6; if(pattacker.HP <= 250) logflags |= 0x8000; holding.addPlayerLog(300, dmg, logflags); pattacker.addPlayerLog(100, dmg, logflags); BasicAmpedEvent e = BasicAmpedEvent.create(holding.getID(), 51, holding.HP); sendEvent(e); rec.score += dmg / 15; rec.atkpt += dmg; holding.rec.dmgpt += dmg; if(holding.HP == 0) { if(stage != null && (stage.rule instanceof DogfightRule)) { if(holding != this && !isNPC() && !holding.isNPC()) rec.killpt++; } else if(stage != null && (stage.rule instanceof TeamDogfightRule)) { if(holding != this && !isNPC() && !holding.isNPC() && getGroup() != holding.getGroup()) rec.killpt++; } else { rec.killpt++; } holding.rec.deadtime = stage.getTime() - stage.countdownstart; holding.rec.diept++; skillBerserker(); skillVictoryHealing(holding); } if(holding.HPshare) stage.processStageRule(2, teamattack != 1 ? ((Object) (this)) : null, ((Object) (new Object[] { holding, new Integer(dmg) }))); else if(holding.HP == 0) stage.processStageRule(0, teamattack != 1 ? ((Object) (this)) : null, holding); else stage.processStageRule(1, teamattack != 1 ? ((Object) (this)) : null, holding); holding.recentAttacker = teamattack != 1 ? ((AmpedModel) (this)) : null; applyStatusModifier(38, 2, Integer.valueOf(td.attr)); if(ctr instanceof AiController) ((AiController)ctr).getAttacked(); } public int getHoldTarget() { return holdtarget; } public int getHoldPlayerStatus(String key) { return getStatus(key, holding); } public int getPlayerStatus(String key) { return getStatus(key, this); } int getStatus(String key, PlayerModel pm) { if(pm == null || pm.psd == null) return -1; if("STR".equals(key)) return pm.psd.STR; if("TEC".equals(key)) return pm.psd.TEC; if("SPD".equals(key)) return pm.psd.SPD; if("JMP".equals(key)) return pm.psd.JMP; if("DEF".equals(key)) return pm.psd.DEF; if("MAXHP".equals(key)) return pm.psd.MAXHP; if("MAXMP".equals(key)) return pm.psd.MAXMP; if("HP".equals(key)) return pm.HP; if("MP".equals(key)) return pm.MP; else return -1; } Vector3D getItemEfxVec() { AmpedModel am[] = getStage().getItemModels(colbnd); for(int i = 0; am[i] != null; i++) { ItemModel im = (ItemModel)am[i]; Vector3D ev = im.getEfxVec(state, pos, getID()); if(ev != null) return ev; } return null; } public void paramup(int i) { } public void paramup(int skillid, int time) { if(!stage.isServer()) return; else return; } public void changeSpecial(ChangeSpecialData scd) { changeSpecial(scd.id, scd.sec, scd.mp, scd.efx, scd.interval); } public void changeSpecial(int npc, int time, int mp, String efx, int interval) { if(!stage.isServer()) return; if(npc <= 0) { if(psd.special != 0) removeStatusModifierType(9); return; } if(psd.special != 0) removeStatusModifierType(9); if(mp == -1 || mp >= 0 && MP > mp) { AbilityData a = new AbilityData(); a.type = 9; a.val = npc; if(mp >= 0) { a.iflags = 16; a.recoverytime = mp + 1; } if(KotoriUtil.isNotEmpty(efx)) { a.iflags |= 4; a.script = efx; } if(interval != 0) { a.iflags |= 8; a.interval = interval; } sendLock(); sendEvent(StatusModifierEvent.create(this, nextModifierID(), a, time)); } } void updateTmpParams() { if(!stage.isServer() || tmpparams == null) return; else return; } public boolean processAmpedEvent(AmpedEvent e) { return processAmpedEvent(e, true, true); } public boolean processAmpedEvent(AmpedEvent e, boolean clearseq, boolean setEventRandom) { super.processAmpedEvent(e, setEventRandom); if(clearseq && isSequenceClearEvent(e.id)) seqs.clear(); int oldtime = time; if(e instanceof PlayerEvent) processPlayerEvent((PlayerEvent)e); if(e instanceof PlayerActionEvent) { if(e.id == 24 && ((PlayerActionEvent)e).option1 == 1) { action.player.setToDir(((PlayerActionEvent)e).dir); return false; } if(isDead()) return false; if(lockactioninterrupt && kframe != null) { return false; } else { continuedemo = false; stopScript(); setVisible(true); return processPlayerActionEvent((PlayerActionEvent)e); } } switch(e.id) { default: break; case 39: // '\'' return processXCGuard((PlayerScriptEvent)e); case 40: // '(' case 41: // ')' case 128: return processPlayerAttackEvent((PlayerAttackEvent)e); case 42: // '*' case 43: // '+' case 166: return processPlayerAttackedEvent((PlayerAttackedEvent)e); case 44: // ',' return processGuardEvent((BasicAmpedEvent)e); case 45: // '-' case 46: // '. ' return processAttackHit(oldtime, (PlayerAttackHitEvent)e); case 51: // '3' return processHoldDamage((BasicAmpedEvent)e); case 48: // '0' return processEmotion((PlayerEmotionEvent)e); case 49: // '1' return processFlags((BasicAmpedEvent)e); case 50: // '2' rideVehicle(((BasicAmpedEvent)e).args[0]); return false; case 52: // '4' rideOffVehicle(false); return false; case 53: // '5' rideOffVehicle(true); return false; case 75: // 'K' return processChangeVoltage((BasicAmpedEvent)e); case 76: // 'L' return processRingout((PlayerRingoutEvent)e); case 55: // '7' return processRevive((PlayerScriptEvent)e); case 56: // '8' return processPlayerScript((PlayerScriptEvent)e); case 57: // '9' return processSequence((PlayerSequenceEvent)e); case 72: // 'H' return processDropStageItem((DropStageItemEvent)e); case 111: // 'o' return processUpdateUserInfo((BasicAmpedEvent)e); case 113: // 'q' return processTryonUserInfo((BasicAmpedEvent)e); case 116: // 't' return processSetProperties((BasicAmpedEvent)e); case 117: // 'u' return processResetRecord((BasicAmpedEvent)e); case 77: // 'M' return processPlayerMark((BasicAmpedEvent)e); case 80: // 'P' return processPlayerChatMark((BasicAmpedEvent)e); case 36: // '$' return processWeaponCharge((BasicAmpedEvent)e); case 114: // 'r' return processModifyStatus((StatusModifierEvent)e); case 115: // 's' return processModifyStatusEnd((BasicAmpedEvent)e); case 35: // '#' return processChangeMP((BasicAmpedEvent)e); case 140: cursorinput = ((BasicAmpedEvent)e).argi; break; case 37: // '%' return processWeaponReload((BasicAmpedEvent)e); case 150: return processMaximizeVoltageRequest(); case 141: int i = ((BasicAmpedEvent)e).argi; if(i >= 30) { boolean _tmp = stage.rule instanceof GuardianRule; } if(i < 10) { rec.bonus += 3 + i * 3; break; } if(i < 20) { i -= 10; rec.gamemoney += KMath.clamp(5 + i * 10, 5, 20); break; } if(i < 30) { i -= 20; if(stage.rule instanceof GuardianRule) { GuardianRule rule = (GuardianRule)stage.rule; rule.pickedKey(i); } break; } if(i >= 40) break; i -= 30; if(stage.rule instanceof MassBusterRule) { MassBusterRule rule = (MassBusterRule)stage.rule; rule.pickedKey(i); } break; case 34: // '"' processParamHP(((BasicAmpedEvent)e).argi, ((BasicAmpedEvent)e).args); break; case 54: // '6' processItemClick((BasicAmpedEvent)e); break; case 122: // 'z' case 123: // '{' ringouton = e.id == 122; ringoutgauge = (float)((BasicAmpedEvent)e).argi * 0.001F; break; case 125: // '}' duellead = ((BasicAmpedEvent)e).argi; break; case 127: // '\177' stopScript(); break; case 142: processSetScpArgi(((BasicAmpedEvent)e).argi); break; case 79: // 'O' guardmode = ((BasicAmpedEvent)e).argi; break; case 74: // 'J' processStageCamera((BasicAmpedEvent)e); break; } return false; } static boolean isSequenceClearEvent(int id) { switch(id) { case 57: // '9' case 77: // 'M' case 80: // 'P' case 90: // 'Z' case 91: // '[' case 92: // '\\' case 141: return false; } return true; } public void processPlayerEvent(PlayerEvent e) { if(time < e.time) updateKFrame(e.time - time); time = e.time; if(!e.hasPosition()) return; getStage().isServer(); pos.set(e.x, e.y, e.z); dir = e.dir; v.y = e.vvy; if(groundparts != null && groundparts.movingfloor) { groundparts.mat.invert(m_1); groundlocalpos.set(pos).transform(m_1); } updateMatrix(); updateBounds(); } public boolean processPlayerActionEvent(PlayerActionEvent e) { action.processPlayerActionEvent(e); return false; } public boolean processXCGuard(PlayerScriptEvent e) { StagePlayerData.Tech t = new StagePlayerData.Tech(); currenttech = t; AccessoryData accs = GameSetting.getSetting().getAccs(userinfo.accs); startScriptID(getKMethodID("xcguard", accs == null ? true : !accs.useaccsguard)); attacktime = e.time; guardOn(1); return false; } private boolean checkMP(StagePlayerData.Tech tec) { if(tec.data.mp == 0) return true; return (float)MP >= (float)tec.data.mp * getMPRate(); } public boolean processPlayerAttackEvent(PlayerAttackEvent e) { currenttechstate = state; attackddir = e.ddir; attackingwpid = 0; if(e.id == 128) scpargi = e.targetid; StagePlayerData.Tech t; if(e.id == 41) { int wid = e.atkid >>> 8; int i = e.atkid & 0xff; int stock = wpstock[0]; if(!isNPC() && e.comboidx != 15) { System.arraycopy(wpstock, 1, wpstock, 0, wpstock.length - 1); wpstock[wpstock.length - 1] = 0; if(stock == wpid) { wpnum--; rec.wpused++; } } if(wid != stock) return false; GameSetting set = GameSetting.getSetting(); WeaponData wd = set.getWeapon(wid); if(wd == null || wd.tec == null || i >= wd.tec.length || wd.tec[i] == null || set.version >= 0 && !userinfo.isPrivilege() && (wid == 141 || wd.isPrivately())) return false; t = new StagePlayerData.Tech(); t.src = wd; t.data = wd.tec[i]; if(!checkMP(t)) return false; KotoriScript ks = t.data.getScriptModelData().getScript(); setupScript(ks); startScript(ks, ks.getKClass().getKMethod(t.data.scp[0]), 0); attackingwpid = wid; if(wpstock[0] == 0) wpreloadstart = time; } else { if(e.atkid < 0 || e.atkid >= psd.tecnum) return false; t = psd.tec[e.atkid]; if(!checkMP(t)) return false; startScriptID(t.kmid[e.comboidx % t.kmid.length]); } currenttech = t; if(currenttech != null && currenttech.data != null) accsVisibleMode(~currenttech.data.accsvanish); if(e.rdir != 0) setToDir(todir + ((float)e.rdir / 255F) * 6.283185F); guardbutton = t.data.button; guardtime = time + guardduration; attacktime = time; addVoltage(-t.data.usevoltage * (voltagelv < 3 ? 1 : 2)); if(t.data.usevoltage > 0) updateVoltage(20, true); lastattackflags = getPlayerLogFlags(t.data); if(HP <= 250) lastattackflags |= 0x8000; if(voltagelv >= 3) lastattackflags |= 0x20000; if(isGroggy()) lastattackflags |= 0x20; if(stage.isServer()) addPlayerLog(10, 0.0F, lastattackflags); if(currenttech != null && currenttech.data != null && currenttech.data.timelimit > 0) { if(skilltimelimits == null) skilltimelimits = new Hashtable(); TechData td = currenttech.data; skilltimelimits.put((new StringBuilder(String.valueOf(td.techset))).append(td.scp[0]).toString(), Long.valueOf((long)stage.getTime() + (long)(td.timelimit * 1000))); } finishoktime = time; MP = Math.max(0, MP - Math.round((float)t.data.mp * getMPRate())); atkvolup = true; return false; } public boolean processPlayerAttackedEvent(PlayerAttackedEvent e) { HP = e.HP; av.set(e.vx, e.vy, e.vz); aback = KMath.getVec(dir, 0.0F, v3_1).dot(av) >= 0.1F; startScriptID(e.hitscp); damagehitefx = e.hitefx; if(e.hitscp != 32768) currenttech = null; attackedtime = e.time; lastattacked = e.hsflag; flowdmgcombo = e.flowdmgcombo; if(e.hsflag == 6) setGroggy(true); else setGroggy(false); if(!isDefent(e.hsflag)) guardbutton = 0; if(!isDead()) applyStatusModifier(46, 3, null); else playerDeadStatusModifier(); attackedModel = null; AmpedModel m = stage.getModel(e.attacker); if(m instanceof PlayerModel) { PlayerModel pm = (PlayerModel)m; if(e.hsflag == 6) pm.finishoktime = time + 1300; else pm.finishoktime = 0; pm.holdtarget = getID(); if(e.hsflag == 2 || pm.finishhit && e.hsflag == 4) pm.finishhit = true; else pm.finishhit = false; attackedModel = m; if(e.id == 166) switch(e.flags) { case 1: // '\001' if(!pm.isDead() && !isDead() && !isDefent(e.hsflag)) { pm.toPos = new Vector3D(); pm.toPos.set(pos); toPos = new Vector3D(); toPos.set(e.x_add, e.y_add, e.z_add); if(e.hitscp != 32768) { pm.av.set(-e.vx, -e.vy, -e.vz); pm.startScriptID(e.hitscp); } } break; } } else { attackerID = e.attacker; } for(int l = 0; l < getAttackSize(); l++) attackAt(l).attacked(m, 1, "", e.hsflag); return false; } public boolean processGuardEvent(BasicAmpedEvent e) { guardbutton = e.argi; guardtime = time + guardduration / 2; return false; } public boolean processAttackHit(int oldtime, PlayerAttackHitEvent e) { if(kframe != null && time != 0) kframe.addDt(time - oldtime); scpargi = e.finelv; if(e.scpid > 0) if(e.id == 46) { WeaponData wd = GameSetting.getSetting().getWeapon(e.scpid >>> 16); KotoriScript ks = wd.tec[0].getScriptModelData().getScript(); setupScript(ks); callScript(ks, ks.getKClass().methods[e.scpid & 0xffff], 0); } else { callScriptID(e.scpid, 0); } for(int l = 0; l < getAttackSize(); l++) attackAt(l).attacked(null, 1, "", 1); if(e.prs > 0.0F) { KMath.getVec(dir, 0.0F, v3_1).scale(-e.prs); prsvec.add(v3_1); } return false; } public boolean processHoldDamage(BasicAmpedEvent e) { HP = e.argi; return false; } public boolean processChangeVoltage(BasicAmpedEvent e) { int oldlv = voltagelv; voltagelv = e.argi; if(voltagelv == 3) voltageval = 1000; else if(voltagelv == 2) { if(voltageval >= 1000) voltageval = 999; else if(voltageval < 600) voltageval = 600; } else if(voltagelv == 1) { if(voltageval >= 600) voltageval = 599; else if(voltageval < 300) voltageval = 300; } else if(voltageval >= 300) voltageval = 299; voltageStateChanged(oldlv, voltagelv); return false; } public boolean processChangeMP(BasicAmpedEvent e) { if(e.args == null) { MP = e.argi; } else { MP = KotoriUtil.argi(e.args[0], 0); applyStatusModifier(KotoriUtil.argi(e.args[0], 1), 0, null); } return false; } public void processEmotionKGLset(KScript kscript) { } public boolean processEmotion(PlayerEmotionEvent e) { if(vehicle != null) return false; emotionnum = (short)e.emoid; scpargi = e.argb; scpargv = e.argv; EmotionData d = GameSetting.getSetting().getEmotion(e.emoid); if(d != null) { KScript ks = d.getScriptModelData().getScript(); if(ks instanceof AmpedScript) { ((AmpedScript)ks).setAmpedModel(this); ((AmpedScript)ks).isemotion = true; } processEmotionKGLset(ks); startScript(ks, ks.getKClass().getKMethod(d.scp), 0); } if(d != null && d.type == 1) continuedemo = true; return false; } public boolean processFlags(BasicAmpedEvent e) { int i = e.argi; controllable = (i & 1) != 0; vanish = (i & 2) != 0; battleoff = (i & 4) != 0; visible = (i & 8) != 0; layercol = (i & 0x10) != 0; return false; } public boolean processRingout(PlayerRingoutEvent e) { if(vehicle != null) rideOffVehicle(false); holder = null; holding = null; HP = e.HP; attackddir = attackdpitch = attackdd = 0; currenttech = null; int scpid; if(e.scpid != 0) scpid = e.scpid; else scpid = getKMethodID(e.scp); startScriptID(scpid); return false; } public boolean processRevive(PlayerScriptEvent e) { pos.set(e.x, e.y, e.z); todir = dir = e.dir; resetPlayer(); int _hp = e.argi; if(_hp <= 0) HP = psd.MAXHP; else HP = _hp * 10; if(stage.getStageMode() == 27) { GameSetting set = GameSetting.getSetting(); if(stage.rule instanceof DogfightRule) MP += (float)psd.MAXMP * set.getTournament(GameRoomInfo.GAMEID_DOGFIGHT).mprecoveryper; else MP += (float)psd.MAXMP * set.getTournament(GameRoomInfo.GAMEID_TEAMDOGFIGHT).mprecoveryper; if(MP > psd.MAXMP) MP = psd.MAXMP; } else { MP = psd.MAXMP; } setVisible(true); int wid = psd.abilityVal(23); if(wid > 0) restoreWeapons(wid); else restoreWeapons(); if(vehicle != null) rideOffVehicle(false); AccessoryData accs = GameSetting.getSetting().getAccs(userinfo.accs); if(accs != null && accs.vehicle != 0) { VehicleContext vc = getVehicleContext(accs.vehicle); rideVehicle(vc); } recoverPlayer(); rec.revive++; return false; } public boolean processPlayerScript(PlayerScriptEvent e) { attackddir = attackdpitch = attackdd = 0; scpargi = e.argi; scpargv = e.argv; if(e.argv instanceof String) startWeaponScript((String)e.argv); else startScriptID(e.scpid); return false; } public boolean processSequence(PlayerSequenceEvent e) { int num = e.seqnum; for(int l = 0; l < num; l++) { PlayerEvent pe = e.eventAt(l); seqs.add(pe); } return false; } public boolean processUpdateUserInfo(BasicAmpedEvent e) { UserInfo ui = userinfo.clone(); ui.setDiff((UserInfo)e.args[0]); if(!ignoreRevive) setUserInfo(ui); else setUserInfo(ui, false); recoverPlayer(); return false; } public boolean processSetProperties(BasicAmpedEvent e) { ga2.stage.event.AmpedProperty.Player property = (ga2.stage.event.AmpedProperty.Player)e.args[0]; setProperties(property); recoverPlayer(); return false; } public boolean processResetRecord(BasicAmpedEvent e) { if(e.argi == 1) { rec.wpused = 0; } else { int g = rec.group; rec.clear(); rec.group = g; } return false; } public boolean processTryonUserInfo(BasicAmpedEvent e) { if(e.args == null) { tryonUserInfo = null; setUserInfo(userinfo, null, false); } else { UserInfo ui = userinfo.clone(); ui.setDiff((UserInfo)e.args[0]); tryonUserInfo = ui; setUserInfo(ui, null, true); } recoverPlayer(); return false; } public boolean processPlayerMark(BasicAmpedEvent e) { mark = e.argi; return false; } public boolean processPlayerChatMark(BasicAmpedEvent e) { chatmark = e.argi - 1; return false; } public boolean processWeaponCharge(BasicAmpedEvent e) { if(wp == null) return true; if(e.args != null && (e.args[0] instanceof int[])) { if(isNPC()) return false; int i[] = (int[])e.args[0]; if(i.length == 1) { int clr = 0; int num = i[0]; if(num == -1) num = wpstock.length; for(int m = wpstock.length - 1; m >= 0; m--) { if(wpstock[m] == 0) continue; if(wpstock[m] == wpid) { wpnum--; rec.wpused++; } wpstock[m] = 0; if(++clr >= num) break; } if(wpstock[0] == 0) wpreloadstart = time; } else if(i.length == 2) { int num = i[0]; boolean spwp = wpstock[0] != 0 && wpid != 0 && wpstock[0] != wpid; int chargewp = spwp ? wpstock[0] : wpid; WeaponData weapon = GameSetting.getSetting().getWeapon(chargewp); if(num == -1) num = weapon.maxstock; int charge = weapon.maxstock - countWeapons() >= num ? num : weapon.maxstock - countWeapons(); System.arraycopy(wpstock, 0, wpstock, charge, countWeapons()); for(int m = 0; m < charge; m++) wpstock[m] = chargewp; } } else { System.arraycopy(wpstock, 0, wpstock, 1, wp.maxstock - 1); wpstock[0] = e.argi; } return false; } public boolean processWeaponReload(BasicAmpedEvent e) { return !restoreWeapons(); } public boolean processModifyStatus(StatusModifierEvent e) { StatusModifier m = StatusModifier.create(e.a); if(m == null) return false; m.id = e.mid; m.sec = e.sec; m.start(this); if(modnum >= mods.length) { mods = (StatusModifier[])KotoriUtil.addArrayOrderNum(mods, m, 10); modnum++; } else { mods[modnum++] = m; } return false; } public boolean processModifyStatusEnd(BasicAmpedEvent e) { if(e.args != null && (e.args[0] instanceof Object[])) { Object o[] = (Object[])e.args[0]; if(o.length == 3 && (o[0] instanceof Integer) && (o[1] instanceof String) && (o[2] instanceof Integer)) { int mod = ((Integer)o[0]).intValue(); String key = (String)o[1]; int arg = ((Integer)o[2]).intValue(); setArgiStatusModifier(mod, key, arg); } else if(o.length == 2 && (o[0] instanceof Integer) && (o[1] instanceof String)) { int mod = ((Integer)o[0]).intValue(); String key = (String)o[1]; resetArgiStatusModifier(mod, key); } } else if(e.args != null && (e.args[0] instanceof int[])) { int m[] = (int[])e.args[0]; for(int l = 0; l < m.length; l++) modifyStatusEnd(m[l]); } else if(e.argi < 0) resetStatusModifiers(); else modifyStatusEnd(e.argi); return false; } private void modifyStatusEnd(int modid) { int i = modifierIndexOf(modid); if(i >= 0) { StatusModifier mod = mods[i]; if(i + 1 < modnum) System.arraycopy(mods, i + 1, mods, i, modnum - i - 1); mods[--modnum] = null; mod.finish(); } } public boolean processChangeSpecial(int npcid, String scp) { avoidAttack(200); if(npcid == 0) { if(stage.isServer()) releaseCarryItem(5F, 2, "hit_bc"); boolean b = startScript(scp); if(!b) { setSpecial(0); recoverPlayer(); } } else { if(vehicle != null) rideOffVehicle(false); setSpecial(npcid); startScript(scp); } lockactioninterrupt = true; return false; } public boolean processMaximizeVoltageRequest() { if(stage.isServer() && stage.getStageMode() == 16) addVoltage(100); return false; } public void processItemClick(BasicAmpedEvent basicampedevent) { } public void processSetScpArgi(int argi) { if(getRunningKFrame() != null) scpargi = argi; } public void processStageCamera(BasicAmpedEvent basicampedevent) { } public void processParamHP(int hp, Object info[]) { if(!stage.isDungeonMode() || npcid != -1) { int prevHP = HP; HP = hp; if(prevHP > 0 && HP <= 0) { rec.deadtime = stage.getTime() - stage.countdownstart; rec.diept++; stage.processStageRule(0, null, this); } } else { boolean dead = true; int newHP; if(info != null && (info[0] instanceof Integer[])) { Integer i[] = (Integer[])info[0]; newHP = i[0].intValue(); dead = i[1].intValue() == 0; } else { newHP = hp; } int damage = HP - newHP; if(stage.rule instanceof DungeonRule) { DungeonRule rule = (DungeonRule)stage.rule; int shareHP = rule.getSharedHP(); if(!dead && shareHP - damage <= 0) damage = shareHP - 1; if(shareHP > 0 && damage != 0) stage.processStageRule(2, this, ((Object) (new Object[] { this, new Integer(damage) }))); } } } public boolean applyStatusModifier(int place, int flags, Object arg) { boolean res = false; for(int l = 0; l < modnum; l++) if(mods[l].modify(place, flags, arg)) res = true; return res; } int getStatusModifierValue(int place) { int val = 0; for(int l = 0; l < modnum; l++) if(mods[l].a.type == place) val += mods[l].a.val; return val; } public void setArgiStatusModifier(int place, String key, int arg) { for(int l = 0; l < modnum; l++) mods[l].setArgi(place, key, arg); } public void resetArgiStatusModifier(int place, String key) { for(int l = 0; l < modnum; l++) mods[l].resetArgi(place, key); } public int getArgiStatusModifier(int place, String key) { for(int l = 0; l < modnum; l++) { int i = mods[l].getArgi(place, key); if(i != -1) return i; } return -1; } public void playerDeadStatusModifier() { for(int l = 0; l < modnum; l++) mods[l].dead(); } void updateStatusModifier() { if(!stage.isServer()) return; if(isDead()) return; if(getRunningKFrame() != null) return; for(int l = 0; l < modnum; l++) { if(mods[l].update()) continue; if(mods[l].lockOnFinish()) sendLock(); sendEvent(BasicAmpedEvent.create(getID(), 115, mods[l].id)); break; } if(HP < 250 && pinchHP > 0) { if(pinchHPtime == 0) pinchHPtime = time + 5000; else if(pinchHPtime <= time) { pinchHPtime = time + 3000; if(HP + 30 >= 250) pinchHPtime = 0; sendEvent(BasicAmpedEvent.create(getID(), 34, HP + 30)); pinchHP -= 30; } } else if(accumdamage != 0 && HP > 10) { sendEvent(BasicAmpedEvent.create(getID(), 34, Math.max(10, HP - accumdamage))); accumdamage = 0; } if(seqs.isEmpty()) applyStatusModifier(38, 0, null); } void removeStatusModifierType(int modtype) { removeStatusModifierType(modtype, null); } void removeStatusModifierType(int modtype, AbilityData a) { int t[] = (int[])null; int c = 0; boolean lock = false; for(int l = modnum - 1; l >= 0; l--) if(a != null && a.compare(mods[l].a) || a == null && mods[l].a.type == modtype) { if(t == null) t = new int[l + 1]; t[c++] = mods[l].id; if(!lock) lock = mods[l].lockOnFinish(); } if(c > 0) { if(lock) sendLock(); if(c == 1) { sendEvent(BasicAmpedEvent.create(getID(), 115, t[0])); } else { int rm[] = t; if(c < t.length) { rm = new int[c]; System.arraycopy(t, 0, rm, 0, c); } sendEvent(BasicAmpedEvent.create(getID(), 115, rm)); } } } void resetStatusModifiers() { int num = modnum; modnum = 0; for(int l = 0; l < num; l++) mods[l].finish(); resetStatusModifiers(0); } void resetPlayerStatusModifiers() { int num = modnum; modnum = 0; for(int l = 0; l < num; l++) mods[l].resetPlayer(); resetStatusModifiers(0); } private void resetStatusModifiers(int ofs) { int num = ofs; for(int l = 0; l < psd.abilitynum; l++) { StatusModifier m = StatusModifier.create(psd.ability[l]); if(m != null) { m.id = -1; m.sec = 0; m.start(this); if(num >= mods.length) { mods = (StatusModifier[])KotoriUtil.addArrayOrderNum(mods, m, 10); num++; } else { mods[num++] = m; } } } for(int l = num; l < mods.length; l++) mods[l] = null; modnum = num; } void resetStaticStatusModifiers() { int oldModnum = modnum; modnum = 0; int num = 0; for(int l = 0; l < oldModnum; l++) if(mods[l].id != -1) { mods[l].reset(); mods[num++] = mods[l]; } else { mods[l].finish(); } resetStatusModifiers(num); } int modifierIndexOf(int mid) { for(int l = 0; l < modnum; l++) if(mods[l].id == mid) return l; return -1; } public StatusModifier[] getStatusModifiers(int modtype) { ArrayList a = new ArrayList(); for(int l = 0; l < modnum; l++) if(mods[l].a.type == modtype) a.add(mods[l]); return a.size() <= 0 ? null : (StatusModifier[])a.toArray(new StatusModifier[a.size()]); } public StatusModifier[] getStatusModifiers() { ArrayList a = new ArrayList(); for(int l = 0; l < modnum; l++) a.add(mods[l]); return a.size() <= 0 ? null : (StatusModifier[])a.toArray(new StatusModifier[a.size()]); } public int nextModifierID() { int i; for(i = 1; modifierIndexOf(i) >= 0; i++); return i; } public void setAbility(AbilityData a, int sec, int flags) { if(getStage().isServer()) { boolean overset = (flags & 1) != 0; boolean replace = (flags & 2) != 0; boolean duplicate = (flags & 4) != 0; boolean replacetype = (flags & 8) != 0; if(!overset && hasModifier(a.type)) return; if(!duplicate && compareModifier(a)) return; sendLock(); if(recentAttacker instanceof PlayerModel) { PlayerModel attacker = (PlayerModel)recentAttacker; a.dmgLv = attacker.psd.level; } if(replace) removeStatusModifierType(a.type, a); else if(replacetype) removeStatusModifierType(a.type); sendEvent(StatusModifierEvent.create(this, nextModifierID(), a, sec)); } } boolean hasModifier(int type) { for(int l = 0; l < modnum; l++) if(mods[l].a.type == type) return true; return false; } boolean compareModifier(AbilityData a) { if(a == null) return false; for(int l = 0; l < modnum; l++) if(a.compare(mods[l].a)) return true; return false; } public boolean sendEvent(AmpedEvent e) { stage.sendEvent(e); if(con instanceof StageConnector.Remote) con.sendToServer(e); return false; } public void sendLock() { if(entry != null) entry.sendLock(); } public void sendVanish(boolean b) { if(vanish == b) { return; } else { vanish = b; sendFlags(controllable, vanish, battleoff, visible, layercol); return; } } public void sendBattleOff(boolean b) { if(battleoff == b) { return; } else { battleoff = b; sendFlags(controllable, vanish, battleoff, visible, layercol); return; } } public void sendControllable(boolean b) { if(controllable == b) { return; } else { controllable = b; sendFlags(controllable, vanish, battleoff, visible, layercol); return; } } public void sendVisible(boolean b) { if(visible == b) { return; } else { visible = b; sendFlags(controllable, vanish, battleoff, visible, layercol); return; } } public void sendLayerCol(boolean b) { if(layercol == b) { return; } else { layercol = b; sendFlags(controllable, vanish, battleoff, visible, layercol); return; } } public void sendFlags(boolean ctr, boolean vns, boolean bto, boolean vis, boolean lcol) { int i = (ctr ? 1 : 0) | (vns ? 2 : 0) | (bto ? 4 : 0) | (vis ? 8 : 0) | (lcol ? 0x10 : 0); sendEvent(BasicAmpedEvent.create(getID(), 49, i)); } public boolean sendScript(String name, int argi, Object argv) { int id = getKMethodID(name); if(id >= 0) { sendEvent(PlayerScriptEvent.create(this, id, argi, argv)); return true; } else { return false; } } public void collisionMask(int mask) { colmask = mask; } public float preMove(Vector3D _v, float fdt, Polygon p[]) { v.set(_v).scale(fdt); float lensq = v.lengthSq(); if(lensq <= 1E-006F) return 1.0F; Vector3D ret = _move(pos.x, pos.y + coly, pos.z, colr, true, v, p, false, false); if(ret.equals(0.0F, 0.0F, 0.0F)) { return 1.0F; } else { float lensq2 = ret.lengthSq(); return 1.0F - lensq2 / lensq; } } public Vector3D move(Vector3D _v, float fdt, Polygon p[]) { return move(_v, fdt, p, false); } public Vector3D move(Vector3D _v, float fdt, Polygon p[], boolean abscorrect) { if(!psd.keeppos) v.set(_v).scale(fdt).add(colvec); else v.set(_v).scale(fdt); if(!prsvec.equals(0.0F, 0.0F, 0.0F)) { float len = prsvec.length(); float pv = 1.0F * fdt; if(len < pv) { v.add(prsvec); prsvec.set(0.0F, 0.0F, 0.0F); } else { v.add((prsvec.x * pv) / len, (prsvec.y * pv) / len, (prsvec.z * pv) / len); prsvec.scale((len - pv) / len); } } movedvec = 1.0F; updateBounds(); if(!stage.isLoungeMode() && (colmask & 1) != 0 && !isDead() && !vanish && !psd.keeppos) { AmpedModel am[] = stage.getModels(colbnd, v); contactBody = false; for(int l = 0; l < am.length && am[l] != null; l++) if(am[l] != this && (am[l] instanceof PlayerModel)) { PlayerModel pm = (PlayerModel)am[l]; if(!pm.isDead() && !pm.vanish && (pm.colmask & 1) != 0 && pm.holder == null) { float t = pm.colbnd.checkXZ(colbnd, -0.04F, v3_2); if(t >= 0.0F) { t = pm.colbnd.checkXZ(colbnd, 0.0F, v3_2); float len = v3_2.length(); float spd = Math.min(0.1F, fdt) * 50F; float s = (1.0F - (len <= 0.9F ? len : 0.9F)) * spd; s = Math.min(s, 1.0F); v3_2.normalize().scale(len * s); } else { t = pm.colbnd.checkXZ(colbnd, v, v3_2); } if(t != -1F) { if(currenttech != null) { v.mult(t, 1.0F, t); } else { v.add(v3_2.x * 0.8F, 0.0F, v3_2.z * 0.85F); pm.colvec.set(-v3_2.x * 0.15F, 0.0F, -v3_2.z * 0.15F); } contactBody = true; } } } } float lensq = v.lengthSq(); if(lensq <= 1E-006F) return v3_3.set(0.0F, 0.0F, 0.0F); float vx = v.x; float vy = v.y; float vz = v.z; Vector3D ret = _move(pos.x, pos.y + coly, pos.z, colr, true, v, p, true, abscorrect); v.set(_v); colvec.set(0.0F, 0.0F, 0.0F); if(!layercol) pos.add(-ret.x, 0.0F, -ret.z); if(layercol) { Rect3D r = null; r = r_1; String layerswitch = stage.getStageData().getParam("layerswitch"); if(layerswitch != null && (layerswitch.equals("room") || layerswitch.equals("shrine"))) { if(!inBound(r)) r = null; } else { ga2.data.AmpedStageData.Layer lyr = (ga2.data.AmpedStageData.Layer)stage.data.layers.get(stage.getLayerIndexAt()); if(!inBound(r, lyr.bounds)) { int n = lyr.nearest(1, pos.x, pos.y, pos.z); if(n < 0) r = null; else r = (Rect3D)lyr.bounds.get(n); } } if(r != null) { Rect3D cb = colbnd; if(cb.x - cb.r < r.x - r.r) { float dx = r.x - r.r - (cb.x - cb.r); pos.x += dx; cb.x += dx; ret.x += dx; } if(cb.x + cb.r > r.x + r.r) { float dx = (r.x + r.r) - (cb.x + cb.r); pos.x += dx; cb.x += dx; ret.x += dx; } if(cb.y + cb.s > r.y + r.s) { float dy = (r.y + r.s) - (cb.y + cb.s); pos.y += dy; cb.y += dy; ret.y += dy; } if(cb.z - cb.t < r.z - r.t) { float dz = r.z - r.t - (cb.z - cb.t); pos.z += dz; cb.z += dz; ret.z += dz; } if(cb.z + cb.t > r.z + r.t) { float dz = (r.z + r.t) - (cb.z + cb.t); pos.z += dz; cb.z += dz; ret.z += dz; } } } if(!ret.equals(0.0F, 0.0F, 0.0F)) { float rx = vx; float ry = vy; float rz = vz; float len2 = (float)Math.sqrt(rx * rx + ry * ry + rz * rz); if(len2 < 0.0001F && len2 > -0.0001F) { movedvec = 1.0F; } else { float len1 = (float)Math.sqrt(ret.x * ret.x + ret.y * ret.y + ret.z * ret.z); movedvec = 1.0F - len1 / len2; } } return ret; } private boolean inBound(Rect3D r, ArrayList bounds) { r.x = r.y = r.z = 0.0F; r.r = r.s = r.t = 0.0F; boolean in = false; for(int l = 0; l < bounds.size(); l++) { ga2.data.AmpedStageData.LayerBounds b = (ga2.data.AmpedStageData.LayerBounds)bounds.get(l); if((b.flags & 1) != 0 && b.contains(envbox)) if(in) { r.expand(b); } else { r.set(b); in = true; } } return in; } private boolean inBound(Rect3D r) { r.set(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); boolean in = false; for(int i = 0; i < stage.data.layers.size(); i++) { ga2.data.AmpedStageData.Layer lyr = (ga2.data.AmpedStageData.Layer)stage.data.layers.get(i); if(inBound(r_2, lyr.bounds)) if(in) { r.expand(r_2); } else { r.set(r_2); in = true; } } return in; } public void playerCheck(AmpedModel m[]) { if(vanish || (colmask & 1) == 0 || isDead()) return; else return; } public void ringoutCheck(boolean b) { ringoutcheck = b; } public void ringoutCheck() { if(!ringoutcheck) return; if(!stage.isServer()) return; boolean b = stage.ringContains(pos.x, pos.y, pos.z); if(!b) { sendLock(); ringoutcheck = false; if(holding != null) holding.recentAttacker = holding.getTeamAttack(this) != 1 ? ((AmpedModel) (this)) : null; if(holder != null) recentAttacker = getTeamAttack(holder) != 1 ? ((AmpedModel) (holder)) : null; int oldhp = HP; int dmg = !(ctr instanceof AiController) || stage.isTournamentTrainingMode() ? 200 : 100; Object ability[] = new Object[2]; applyStatusModifier(84, 0, ((Object) (ability))); int abrate = (ability[0] instanceof Integer) ? ((Integer)ability[0]).intValue() : 0; String abscp = (ability[1] instanceof String) ? (String)ability[1] : null; int rate = Math.max(0, 100 + psd.sumAbility(18) + abrate); dmg = (dmg * rate) / 100; if(abrate != -100) if(stage.rule instanceof DogfightRule) { if(GameSetting.getSetting().getTournament(GameRoomInfo.GAMEID_DOGFIGHT).deathringout) dmg = HP; } else if((stage.rule instanceof TeamDogfightRule) && GameSetting.getSetting().getTournament(GameRoomInfo.GAMEID_TEAMDOGFIGHT).deathringout) dmg = HP; if(!HPshare) HP = Math.max(0, HP - dmg); else stage.processStageRule(2, this, ((Object) (new Object[] { this, new Integer(dmg) }))); if(vehicle == null) { int scpid = getKMethodID(KotoriUtil.isNotEmpty(abscp) ? abscp : stage.ringoutscp); sendEvent(PlayerRingoutEvent.create(this, HP, scpid)); } else { sendEvent(PlayerRingoutEvent.create(this, HP, KotoriUtil.isNotEmpty(abscp) ? abscp : stage.ringoutscp)); } if(oldhp > 0 && HP == 0) { if(recentAttacker instanceof PlayerModel) { PlayerModel rap = (PlayerModel)recentAttacker; if(stage != null && (stage.rule instanceof DogfightRule)) { if(rap != this && !isNPC() && !rap.isNPC()) rap.rec.killpt++; } else if(stage != null && (stage.rule instanceof TeamDogfightRule)) { if(rap != this && !isNPC() && !rap.isNPC() && getGroup() != rap.getGroup()) rap.rec.killpt++; } else { rap.rec.killpt++; } } rec.deadtime = stage.getTime() - stage.countdownstart; rec.diept++; stage.processStageRule(0, recentAttacker, this); } holdTarget(false); } } public boolean groundCheck(float margin, Polygon p[]) { return groundCheck(margin, pos.y, p); } public boolean groundCheck(float margin, float prevy, Polygon p[]) { boolean grounded = false; float py = prevy + footy; float len = pos.y - prevy - footlen - margin; float maxy = -100000F; float footwidth = 0.09F * psd.scale; Polygon _g; Polygon g = _g = groundCheck(pos.x - footwidth, py, pos.z - footwidth, len, p, v3_1); if(_g != null) maxy = v3_1.y; _g = groundCheck(pos.x + footwidth, py, pos.z - footwidth, len, p, v3_1); if(_g != null && v3_1.y > maxy) { g = _g; maxy = v3_1.y; } _g = groundCheck(pos.x + footwidth, py, pos.z + footwidth, len, p, v3_1); if(_g != null && v3_1.y > maxy) { g = _g; maxy = v3_1.y; } _g = groundCheck(pos.x - footwidth, py, pos.z + footwidth, len, p, v3_1); if(_g != null && v3_1.y > maxy) { g = _g; maxy = v3_1.y; } if(g != null) { groundparts = stage.getStageParts(g.id); groundpoly = g; grounded = true; } if(psd.isFlying() && py + len <= psd.altitude && psd.altitude > maxy) { grounded = true; v3_1.y = psd.altitude; maxy = v3_1.y; groundparts = null; groundpoly = null; } if(grounded) { if(stage.isLoungeMode()) pos.y = pos.y * 0.6F + ((v3_1.y - footy) + footlen) * 0.4F; else pos.y = v3_1.y; return true; } if(stage.isLoungeMode() && stage.getStageMode() != 9 && getNPCID() == -1) pos.y -= 0.1F; return false; } public boolean check(int type) { return !vanish && (type & colmask) != 0 && !isDead(); } public float check(Rect3D r, Vector3D w, Vector3D result, int type) { if(!vanish && (type & colmask) != 0 && !isDead()) return colbnd.check(r, w, result); else return -1F; } public float check(Rect3D r, Vector3D result, int type) { if(!vanish && (type & colmask) != 0 && !isDead()) return colbnd.check(r, result); else return -1F; } public void doRideOn() { if(!stage.isServer()) return; if(vehicle != null) return; AmpedModel m = stage.getModel(scpargi); if((m instanceof ItemModel) && ((ItemModel)m).isPickable()) { ItemModel im = (ItemModel)m; if(im.ctx == null) return; VehicleData vd = GameSetting.getSetting().getVehicle(im.ctx.vehicleid); if(vd == null) return; stage.sendEvent(BasicAmpedEvent.create(im.getID(), 66)); sendLock(); im.ctx.HP = im.HP; if(vd.parts != 18) { sendEvent(BasicAmpedEvent.create(getID(), 50, im.ctx)); } else { if(im.itemdata.basetype == 4 && im.stageEntry != null) im.dir = KMath.D2R(im.stageEntry.dir); sendEvent(BasicAmpedEvent.create(getID(), 50, ((Object) (new Object[] { im.ctx, new Position(im.pos.x, im.pos.y, im.pos.z, im.dir) })))); } } } public void setViewAction(int aid) { setViewAction(aid, 0, 1.0F); } public void setViewAction(int i, int j, float f) { } public Position getPosition(Position p) { p.set(pos, todir); return p; } public void setPosition(Position p) { pos.set(p); dir = todir = KMath.unitdir(p.dir); updateMatrix(); updateBounds(); } public void setG(float g, boolean b) { scpG = g; disableactG = b; } public void setLandScript(String scp) { setLandScript(scp, false); } public void setLandScript(String scp, int avoidtime) { landavoidatktime = avoidtime; setLandScript(scp, false); } public void setLandScript(String scp, boolean ascall) { if(psd.isFlying() && psd.landscp != null) landscp = psd.landscp; else landscp = scp; calllandscp = ascall; landstop = false; if(kframe != null) { PlayerActionEvent e = PlayerActionEvent.create1(this, 33, 33); processPlayerActionEvent(e); } } public void setLandStop() { landstop = true; landscp = null; if(kframe != null) { PlayerActionEvent e = PlayerActionEvent.create1(this, 33, 33); processPlayerActionEvent(e); } } public void setLandStop(int avoidtime) { landavoidatktime = avoidtime; setLandStop(); } public void setWallScript(String scp) { wallscp = scp; } public void setWallScript(String scp, int avoidtime) { wallavoidatktime = avoidtime; setWallScript(scp); } public void setHitScript(String scp, String gscp, String ascp, String empscp) { hitscp_ok = scp; hitscp_guarded = gscp; hitscp_air = ascp; hitscp_emptyMP = empscp; } public void setHitLevel(int lv) { hitlv = lv; hitscp_ok = hitscp_guarded = hitscp_air = hitscp_emptyMP = null; } public void setHitStop(int lv) { hitstop = lv; hitlv = 0; hitscp_ok = hitscp_guarded = hitscp_air = hitscp_emptyMP = null; } public void setAttackOffScript(String scp) { atkoffscp = scp; } public void cursorInput(int def, boolean send, boolean global) { if(ctr != null) { int dir = ctr.getCursorDir(); if(dir > 0) { dir--; int pdir = global ? 0 : Math.round((KMath.unitdir(this.dir) / 3.141593F) * 16F); dir = (dir - pdir) / 4; if(dir < 0) dir += 8; if(cursorinput == dir) return; cursorinput = dir; if(send) sendEvent(BasicAmpedEvent.create(getID(), 140, dir)); } else { if(cursorinput == def) return; cursorinput = def; if(send) sendEvent(BasicAmpedEvent.create(getID(), 140, def)); } } } public void lockScript(boolean b) { scplocked = b; } public void lookTo(float vx, float vz, boolean set) { turnTo(vx - pos.x, vz - pos.z, set); } public void turnTo(float vx, float vz, boolean set) { Vector3D a = v3_1.set(vx, 0.0F, vz); if(a.x == 0.0F && a.z == 0.0F) return; a.normalize(); float ndir = KMath.getDir(a.x, a.z); if(set) { dir = todir = ndir; updateMatrix(); } else { todir = ndir; } } public void turnToAttack() { if(attackddir != 0) { dir = todir += (float)attackddir / 64F; updateMatrix(); attackddir = 0; } } public void pushAction() { action.pushAction(); } public void popAction() { action.popAction(); } public int getMAXHP() { if(psd != null) return psd.MAXHP; else return 0; } private static final float powmap[] = { 0.2F, 0.4F, 0.6F, 0.8F, 0.9F, 1.0F, 1.1F, 1.15F, 1.2F, 1.25F, 1.3F, 1.4F, 1.5F, 1.6F, 1.7F, 1.8F, 1.9F, 2.0F, 2.1F, 2.2F, 2.3F, 2.4F, 2.5F, 2.7F, 3F }; private static final float walkmap[] = { 1.5F, 2.0F, 2.4F, 2.8F, 3F, 3.6F, 4F, 4.4F, 4.7F, 5F, 5.3F, 5.6F, 5.8F, 6F, 6.3F, 6.7F, 7F, 7.3F, 7.6F, 8F, 8.3F, 8.7F, 9F, 9.5F, 10F }; private static final float dashmap[] = { 2.0F, 3F, 4F, 4.5F, 5.5F, 6.5F, 7F, 7.5F, 8F, 8.5F, 9F, 9.5F, 10F, 11F, 12F, 12.5F, 13F, 13.5F, 14F, 14.5F, 15F, 15.5F, 16F, 17F, 18F }; private static final float jmpmap[] = { 7F, 10F, 11F, 11.4F, 12F, 12.6F, 13.4F, 14F, 14.5F, 15F, 15.5F, 16F, 16.5F, 17F, 17.5F, 18F, 18.5F, 19F, 19.5F, 20F, 20.5F, 21F, 21.5F, 22F, 22.5F }; private static final float defmap[] = { 2.0F, 1.5F, 1.3F, 1.2F, 1.1F, 1.0F, 0.9F, 0.85F, 0.8F, 0.75F, 0.73F, 0.68F, 0.65F, 0.6F, 0.58F, 0.55F, 0.52F, 0.5F, 0.47F, 0.44F, 0.41F, 0.38F, 0.35F, 0.32F, 0.3F }; private static final float rangemap[] = { 2.0F, 3F, 3.5F, 4F, 4.5F, 5F, 5.5F, 6F, 6.5F, 7F, 7.5F, 8F, 8.5F, 9F, 9.5F, 10F, 10.5F, 11F, 11.5F, 12F, 12.4F, 12F, 8F, 13F, 3F, 13F, 6F, 14F }; private static final float sightmap[] = { 0.4F, 0.5F, 0.6F, 0.7F, 0.8F, 0.9F, 1.0F, 1.0F, 1.0F, 1.1F, 1.2F, 1.3F, 1.4F, 1.5F, 1.7F, 1.7F, 1.7F, 1.7F, 1.7F, 1.7F, 1.7F, 1.7F, 1.7F, 1.7F, 1.7F }; private static final int weaponmap[][] = { new int[11], { 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3 }, { 0, 0, 0, 1, 2, 2, 3, 3, 4, 4, 5 }, { 0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 5 }, { 0, 1, 2, 2, 3, 4, 5, 6, 6, 7, 7 }, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8 }, { 0, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8 } }; private static final float wpreloadmap[] = { 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F }; private static final float contdefmap[] = { 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, 0.98F, 0.95F, 0.92F, 0.9F, 0.86F, 0.84F, 0.82F, 0.8F, 0.76F, 0.72F, 0.68F, 0.64F, 0.6F, 0.56F, 0.5F }; public static boolean autoguard = false; int time; public int guardmode; public int areahash; UserInfo userinfo; int npcid; ItemInfo dropItemInfo; StagePlayerData psd; PlayerViewData pvd; PlayerScriptInfo info; int rank; int basetype; public int wpid; public WeaponData wp; public int wpnum; public int wpstock[]; public int wpreloadstart; public int wpreloadtime; public float wpreloadrate; public int attackingwpid; VehicleContext vehicle; PlayerAction action; public int stresstime; public int state; public int movestate; private int battlestate; public float dir; float todir; public final Vector3D v = new Vector3D(); public int actlock; public int atklock; public int colmask; public boolean layercol; public float coly; public float colr; public float footy; public float footlen; public float centery; public float centerz; public final Rect3D colbnd = new Rect3D(); public final Rect3D colbndbody = new Rect3D(); public final Rect3D atkbnd = new Rect3D(); public final Rect3D atkbndbody = new Rect3D(); StagePartsModel groundparts; Polygon groundpoly; final Vector3D groundlocalpos = new Vector3D(); public boolean ringoutcheck; public boolean ringouton; public float ringoutgauge; public int duellead; public float movedvec; public boolean contactBody; final Vector3D colvec = new Vector3D(); final Vector3D prsvec = new Vector3D(); ArrayList seqs; KotoriScript basescp[]; int tecscpnum; KotoriScript tecscp[]; short methodmap[]; String landscp; boolean calllandscp; boolean landstop; String wallscp; String hitscp_ok; String hitscp_guarded; String hitscp_air; String hitscp_emptyMP; String atkoffscp; boolean scplocked; String spinscp; int hitlv; int hitstop; public int HP; public int MP; public float wspd; public float dspd; public float jspd; public float djspd; public float scpG; public boolean disableactG; public float groggylimit; public float pow; public float tpow; public float def; public float contdef; boolean change_def; public int featureflag; public float aimrange; public float aimsight; public int jumpcount; public float movtune; public boolean HPshare; public ArrayList tmpparams; public int level; public PlayerRecord rec; boolean vanish; boolean controllable; boolean battleoff; public int matchingflags; public boolean boss; int mark; int chatmark; public int recovertime; public int gutsnum; public int mpusingrate; public int pinchHP; public int pinchHPtime; StagePlayerData.Tech currenttech; int currenttechstate; int attackddir; int attackdpitch; int attackdd; int finishoktime; int turntime; boolean finishhit; int lastattackflags; boolean atkvolup; int keyedtime; int jumptoptime; int dashontime; int landtime; GlideCombo glide; public int attackerID; public AmpedModel recentAttacker; public final Vector3D av = new Vector3D(); public boolean aback; public int avoidattacktime; public int avoidattacktype; public int landavoidatktime; public int wallavoidatktime; public float accumdmg; int groggytime; int accumdmgresettime; int guardbutton; int lastattacked; int guardtime; int guardtype; int lastguard; int attacktime; int attackedtime; boolean flowflag; boolean downflag; int flowdmgcombo; int damagehitefx; float contdmgrate; int damagerate; int damageratetype; int lastdamagerate; int lastdamageratetype; Vector3D toPos; public AmpedModel attackedModel; int hittype; int hitkind; int lasthittype; int lasthitkind; int accumdamage; int guardduration; int pguardduration; PlayerModel holder; PlayerModel holding; int holdtarget; final Vector3D holdreleasepos = new Vector3D(); String holdreleasescp; int voltagelv; int voltageval; int voltagetime; float volatkrate; float voldefrate; int voltagerate; public Controller ctr; boolean comboinput; boolean guardinput; boolean spininput; boolean wakeinput; int combobutton; public int comboidx; public int combomode; int cursorinput; boolean lockactioninterrupt; StageConnector con; StageServerPlayerEntry entry; public ArrayList log; final Vector2D v2_1 = new Vector2D(); final Vector2D v2_2 = new Vector2D(); final Quaternion q_1 = new Quaternion(); final Quaternion q_2 = new Quaternion(); final Matrix m_2 = new Matrix(); final Rect3D r_1 = new Rect3D(); final Rect3D r_2 = new Rect3D(); final GuardParam guardp = new GuardParam(); int modnum; StatusModifier mods[]; int changespecialid; UserInfo tryonUserInfo; public boolean rotenopen; public short emotionnum; public boolean ignoreRevive; public int parentid; public int gentargetid; public int starttime; public int alivetime; public String npckey; public byte npcnum; public int escapeemotion; public boolean uiavatarenabled; public short thead; public short tface; public short tbody; public short tdeco; public int tskin; public boolean continuedemo; Hashtable skilltimelimits; static final int HITNOP_SCRIPTID = 32768; int voltiming; Rect3D lyrbnd; }