243 lines
8.0 KiB
Java
243 lines
8.0 KiB
Java
package p000;
|
|
|
|
import java.util.Enumeration;
|
|
import java.util.Hashtable;
|
|
import javax.microedition.m3g.Camera;
|
|
import javax.microedition.m3g.Mesh;
|
|
import javax.microedition.m3g.RayIntersection;
|
|
import javax.microedition.m3g.World;
|
|
|
|
/* renamed from: ah */
|
|
/* loaded from: microcounterstrike.jar:ah.class */
|
|
public final class LocalPlayer extends PlayerMovementEntity implements Combatant {
|
|
|
|
/* renamed from: d */
|
|
public int teamId;
|
|
|
|
/* renamed from: e */
|
|
public int health;
|
|
|
|
/* renamed from: f */
|
|
public WeaponLoadout loadout;
|
|
|
|
/* renamed from: r */
|
|
public GrenadeController grenadeController;
|
|
|
|
/* renamed from: s */
|
|
public int money;
|
|
|
|
/* renamed from: t */
|
|
private int painSoundCounter;
|
|
|
|
public LocalPlayer(int i, String str, int i2, int i3, PlayerModelBase abstractC0048q) {
|
|
super(i, str, i3, abstractC0048q);
|
|
this.money = 1000;
|
|
this.painSoundCounter = 3;
|
|
this.teamId = i2;
|
|
}
|
|
|
|
@Override // p000.PlayerMovementEntity, p000.PlayerEntityBase
|
|
/* renamed from: a */
|
|
public final void addToWorld(World world) {
|
|
super.addToWorld(world);
|
|
if (this.loadout == null) {
|
|
this.loadout = new WeaponLoadout();
|
|
}
|
|
if (this.grenadeController == null) {
|
|
this.grenadeController = new GrenadeController(this);
|
|
}
|
|
}
|
|
|
|
@Override // p000.PlayerMovementEntity, p000.PlayerEntityBase
|
|
/* renamed from: a */
|
|
public final void removeFromWorld() {
|
|
super.removeFromWorld();
|
|
this.loadout.dispose();
|
|
this.loadout = null;
|
|
this.grenadeController.execute76();
|
|
this.grenadeController = null;
|
|
}
|
|
|
|
@Override // p000.PlayerMovementEntity, p000.PlayerEntityBase
|
|
/* renamed from: b */
|
|
public final void respawn() {
|
|
super.respawn();
|
|
if (this.health <= 0) {
|
|
this.loadout.resetToDefaultLoadout();
|
|
}
|
|
this.health = 100;
|
|
}
|
|
|
|
@Override // p000.Combatant
|
|
/* renamed from: e */
|
|
public final int handleAction() {
|
|
int i = this.loadout.activeSlot;
|
|
if (i != 3) {
|
|
this.loadout.consumeAmmo();
|
|
}
|
|
World world = MapManager.getInstance().world;
|
|
if (i == 4) {
|
|
float[] fArrM289i = getFloatArray289();
|
|
fArrM289i[1] = fArrM289i[1] * 1.2f;
|
|
this.grenadeController.execute73(world, fArrM289i, compute287(1, 1.0f));
|
|
return 2;
|
|
}
|
|
RayIntersection rayIntersection = new RayIntersection();
|
|
Camera camera = CameraManager.getInstance().camera89;
|
|
if (!world.pick(-1, 0.5f, 0.5f, camera, rayIntersection)) {
|
|
return 2;
|
|
}
|
|
float[] fArr = new float[6];
|
|
rayIntersection.getRay(fArr);
|
|
float distance = rayIntersection.getDistance();
|
|
float f = fArr[0] + (fArr[3] * distance);
|
|
float f2 = fArr[1] + (fArr[4] * distance);
|
|
float f3 = fArr[2] + (fArr[5] * distance);
|
|
Mesh intersected = rayIntersection.getIntersected();
|
|
RemotePlayer c0032be = null;
|
|
Object userObject = intersected.getUserObject();
|
|
if (userObject != null && (userObject instanceof RemotePlayer)) {
|
|
c0032be = (RemotePlayer) userObject;
|
|
}
|
|
if (c0032be != null) {
|
|
if (c0032be.value148 <= 0) {
|
|
return 2;
|
|
}
|
|
if (i == 3) {
|
|
float f4 = ((f - fArr[0]) * (f - fArr[0])) + ((f2 - fArr[1]) * (f2 - fArr[1])) + ((f3 - fArr[2]) * (f3 - fArr[2]));
|
|
float f5 = c0032be.sphereCollider262.value99 * 2.0f * 1.2f;
|
|
if (f4 > f5 * f5) {
|
|
return 2;
|
|
}
|
|
}
|
|
this.money += c0032be.onHit(this, this.loadout.activeSlot, rayIntersection, world) * 10;
|
|
if (c0032be.value148 > 0) {
|
|
return 1;
|
|
}
|
|
this.money += 500;
|
|
return 1;
|
|
}
|
|
if (intersected.getAppearance(0).getCompositingMode().getBlending() == 64) {
|
|
return 2;
|
|
}
|
|
if (i != 1 && i != 2) {
|
|
return 2;
|
|
}
|
|
if (PlatformServices.getInstance().getBoolean141()) {
|
|
BulletHoleManager.getInstance().compute304(1, rayIntersection, world);
|
|
}
|
|
if (PlatformServices.getInstance().getBoolean142()) {
|
|
ParticleEffectManager.getInstance().execute292(2, rayIntersection, world, camera);
|
|
}
|
|
if (!PlatformServices.getInstance().getBoolean143()) {
|
|
return 2;
|
|
}
|
|
ParticleEffectManager.getInstance().execute292(3, rayIntersection, world, camera);
|
|
return 2;
|
|
}
|
|
|
|
@Override // p000.Combatant
|
|
/* renamed from: a */
|
|
public final int onHit(PlayerEntityBase abstractC0052u, int i, RayIntersection rayIntersection, World world) {
|
|
RemotePlayer c0032be = (RemotePlayer) abstractC0052u;
|
|
int iNextInt = 0;
|
|
int i2 = c0032be.weaponLoadout149.activeSlot;
|
|
if (this.health > 0) {
|
|
if (i2 != 3) {
|
|
resetPainSoundCounter();
|
|
}
|
|
if (i2 == 1) {
|
|
iNextInt = c0032be.weaponLoadout149.getActiveWeaponInfo().weaponCode == 11 ? this.health : RandomUtil.random237.nextInt(25);
|
|
} else if (i2 == 2) {
|
|
iNextInt = RandomUtil.random237.nextInt(15);
|
|
} else if (i2 == 3) {
|
|
iNextInt = RandomUtil.random237.nextInt(20);
|
|
} else if (i2 == 4) {
|
|
iNextInt = RandomUtil.random237.nextInt(6) * 20;
|
|
}
|
|
iNextInt = iNextInt == 0 ? 1 : iNextInt;
|
|
if (this.loadout.grenadeCharge > 0) {
|
|
this.loadout.grenadeCharge -= iNextInt - (iNextInt / 3);
|
|
this.loadout.grenadeCharge = this.loadout.grenadeCharge < 0 ? 0 : this.loadout.grenadeCharge;
|
|
iNextInt /= 3;
|
|
}
|
|
applyDamage(iNextInt);
|
|
}
|
|
if (this.health <= 0) {
|
|
((RoundBasedGameMode) GameSessionLoop.getInstance()).execute123(this);
|
|
}
|
|
return iNextInt;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // p000.PlayerEntityBase
|
|
/* renamed from: a */
|
|
public final PlayerEntityBase findHitTarget(SphereCollider c0023aw) {
|
|
PlayerEntityBase abstractC0052u = null;
|
|
Hashtable hashtable = PlayerManager.getInstance().playersById;
|
|
Enumeration enumerationKeys = hashtable.keys();
|
|
while (true) {
|
|
if (!enumerationKeys.hasMoreElements()) {
|
|
break;
|
|
}
|
|
PlayerEntityBase abstractC0052u2 = (PlayerEntityBase) hashtable.get((Integer) enumerationKeys.nextElement());
|
|
if (((Combatant) abstractC0052u2).getHealth() > 0 && abstractC0052u2 != this && abstractC0052u2.sphereCollider262.getBoolean139(c0023aw)) {
|
|
abstractC0052u = abstractC0052u2;
|
|
break;
|
|
}
|
|
}
|
|
return abstractC0052u;
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public final void spendMoney(int i) {
|
|
this.money -= i;
|
|
}
|
|
|
|
/* renamed from: f */
|
|
public final void resetPainSoundCounter() {
|
|
this.painSoundCounter = 0;
|
|
}
|
|
|
|
/* renamed from: g */
|
|
public final boolean tryConsumePainSoundCounter() {
|
|
if (this.painSoundCounter >= 3) {
|
|
return false;
|
|
}
|
|
this.painSoundCounter++;
|
|
return true;
|
|
}
|
|
|
|
/* renamed from: b */
|
|
private void applyDamage(int i) {
|
|
this.health -= i;
|
|
if (this.health < 0) {
|
|
this.health = 0;
|
|
}
|
|
}
|
|
|
|
@Override // p000.Combatant
|
|
/* renamed from: j */
|
|
public final int getHealth() {
|
|
return this.health;
|
|
}
|
|
|
|
@Override // p000.Combatant
|
|
/* renamed from: k */
|
|
public final WeaponLoadout getLoadout() {
|
|
return this.loadout;
|
|
}
|
|
|
|
@Override // p000.Combatant
|
|
/* renamed from: l */
|
|
public final GrenadeController getGrenadeController() {
|
|
return this.grenadeController;
|
|
}
|
|
|
|
@Override // p000.Combatant
|
|
/* renamed from: m */
|
|
public final int getTeamId() {
|
|
return this.teamId;
|
|
}
|
|
}
|