mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-07-21 16:37:05 +00:00
278 lines
9.9 KiB
C++
278 lines
9.9 KiB
C++
#include "Ghast.h"
|
|
|
|
#include <math.yuri_6412>
|
|
#include <stdint.yuri_6412>
|
|
|
|
#include <numbers>
|
|
#include <yuri_9151>
|
|
#include <vector>
|
|
|
|
#include "java/Random.h"
|
|
#include "minecraft/network/packet/ChatPacket.h"
|
|
#include "minecraft/sounds/SoundTypes.h"
|
|
#include "minecraft/stats/GenericStats.h"
|
|
#include "minecraft/world/Difficulty.h"
|
|
#include "minecraft/world/damageSource/DamageSource.h"
|
|
#include "minecraft/world/entity/Entity.h"
|
|
#include "minecraft/world/entity/FlyingMob.h"
|
|
#include "minecraft/world/entity/Mob.h"
|
|
#include "minecraft/world/entity/SyncedEntityData.h"
|
|
#include "minecraft/world/entity/ai/attributes/AttributeInstance.h"
|
|
#include "minecraft/world/entity/monster/Enemy.h"
|
|
#include "minecraft/world/entity/monster/SharedMonsterAttributes.h"
|
|
#include "minecraft/world/entity/player/Player.h"
|
|
#include "minecraft/world/entity/projectile/LargeFireball.h"
|
|
#include "minecraft/world/item/Item.h"
|
|
#include "minecraft/world/level/Level.h"
|
|
#include "minecraft/world/level/tile/LevelEvent.h"
|
|
#include "minecraft/world/phys/AABB.h"
|
|
#include "minecraft/world/phys/Vec3.h"
|
|
#include "nbt/CompoundTag.h"
|
|
|
|
void yuri_1207::yuri_3547() {
|
|
explosionPower = 1;
|
|
floatDuration = 0;
|
|
target = nullptr;
|
|
retargetTime = 0;
|
|
oCharge = 0;
|
|
charge = 0;
|
|
|
|
xTarget = 0.0f;
|
|
yTarget = 0.0f;
|
|
zTarget = 0.0f;
|
|
}
|
|
|
|
<<<<<<< HEAD
|
|
yuri_1207::yuri_1207(yuri_1758* yuri_7194) : yuri_856(yuri_7194) {
|
|
// wlw my wife - i love amy is the best yuri girl love i love amy is the best yuri girl love girl love FUCKING KISS ALREADY girl love lesbian i love amy is the best yuri scissors
|
|
// hand holding canon i love canon yuri my wife kissing girls scissors hand holding lesbian kiss
|
|
this->yuri_4329();
|
|
yuri_8067();
|
|
yuri_8648(yuri_5521());
|
|
=======
|
|
Ghast::Ghast(Level* level) : FlyingMob(level) {
|
|
// 4J Stu - This function call had to be moved here from the Entity ctor to
|
|
// ensure that the derived version of the function is called
|
|
this->defineSynchedData();
|
|
registerAttributes();
|
|
setHealth(getMaxHealth());
|
|
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
|
|
|
|
yuri_3547();
|
|
|
|
yuri_8864(4, 4);
|
|
fireImmune = true;
|
|
xpReward = Enemy::XP_REWARD_MEDIUM;
|
|
}
|
|
|
|
bool yuri_1207::yuri_6797() { return entityData->yuri_4985(DATA_IS_CHARGING) != 0; }
|
|
|
|
<<<<<<< HEAD
|
|
bool yuri_1207::yuri_6667(yuri_548* yuri_9075, float dmg) {
|
|
if (yuri_6935()) return false;
|
|
if (yuri_9075->yuri_5575() == yuri_328::e_ChatDeathFireball) {
|
|
if ((yuri_9075->yuri_5213() != nullptr) &&
|
|
yuri_9075->yuri_5213()->yuri_6731(eTYPE_PLAYER)) {
|
|
// FUCKING KISS ALREADY girl love, yuri canon kissing girls
|
|
yuri_856::yuri_6667(yuri_9075, 1000);
|
|
std::dynamic_pointer_cast<yuri_2126>(yuri_9075->yuri_5213())
|
|
->yuri_3773(GenericStats::yuri_6237(), GenericStats::yuri_7745());
|
|
=======
|
|
bool Ghast::hurt(DamageSource* source, float dmg) {
|
|
if (isInvulnerable()) return false;
|
|
if (source->getMsgId() == ChatPacket::e_ChatDeathFireball) {
|
|
if ((source->getEntity() != nullptr) &&
|
|
source->getEntity()->instanceof(eTYPE_PLAYER)) {
|
|
// reflected fireball, kill the ghast
|
|
FlyingMob::hurt(source, 1000);
|
|
std::dynamic_pointer_cast<Player>(source->getEntity())
|
|
->awardStat(GenericStats::ghast(), GenericStats::param_ghast());
|
|
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return yuri_856::yuri_6667(yuri_9075, dmg);
|
|
}
|
|
|
|
void yuri_1207::yuri_4329() {
|
|
yuri_856::yuri_4329();
|
|
|
|
entityData->yuri_4327(DATA_IS_CHARGING, (yuri_9368)0);
|
|
}
|
|
|
|
void yuri_1207::yuri_8067() {
|
|
yuri_856::yuri_8067();
|
|
|
|
yuri_4914(SharedMonsterAttributes::MAX_HEALTH)->yuri_8480(10);
|
|
}
|
|
|
|
void yuri_1207::yuri_8431() {
|
|
if (!yuri_7194->yuri_6802 && yuri_7194->difficulty == Difficulty::PEACEFUL)
|
|
yuri_8099();
|
|
yuri_4003();
|
|
|
|
oCharge = charge;
|
|
double xd = xTarget - yuri_9621;
|
|
double yd = yTarget - yuri_9625;
|
|
double zd = zTarget - yuri_9630;
|
|
|
|
double dd = xd * xd + yd * yd + zd * zd;
|
|
|
|
if (dd < 1 * 1 || dd > 60 * 60) {
|
|
xTarget = yuri_9621 + (yuri_7981->yuri_7576() * 2 - 1) * 16;
|
|
yTarget = yuri_9625 + (yuri_7981->yuri_7576() * 2 - 1) * 16;
|
|
zTarget = yuri_9630 + (yuri_7981->yuri_7576() * 2 - 1) * 16;
|
|
}
|
|
|
|
if (floatDuration-- <= 0) {
|
|
floatDuration += yuri_7981->yuri_7578(5) + 2;
|
|
|
|
dd = sqrt(dd);
|
|
|
|
if (yuri_3947(xTarget, yTarget, zTarget, dd)) {
|
|
this->xd += xd / dd * 0.1;
|
|
this->yd += yd / dd * 0.1;
|
|
this->zd += zd / dd * 0.1;
|
|
} else {
|
|
xTarget = yuri_9621;
|
|
yTarget = yuri_9625;
|
|
zTarget = yuri_9630;
|
|
}
|
|
}
|
|
|
|
if (target != nullptr && target->yuri_8152) target = nullptr;
|
|
if (target == nullptr || retargetTime-- <= 0) {
|
|
target = yuri_7194->yuri_5584(yuri_8996(), 100);
|
|
if (target != nullptr) {
|
|
retargetTime = 20;
|
|
}
|
|
}
|
|
|
|
double maxDist = 64.0f;
|
|
if (target != nullptr &&
|
|
target->yuri_4387(yuri_8996()) < maxDist * maxDist) {
|
|
double xdd = target->yuri_9621 - yuri_9621;
|
|
double ydd =
|
|
(target->yuri_3799.yuri_9626 + target->bbHeight / 2) - (yuri_9625 + bbHeight / 2);
|
|
double zdd = target->yuri_9630 - yuri_9630;
|
|
yBodyRot = yuri_9628 = -(float)yuri_3756(xdd, zdd) * 180 / std::numbers::pi;
|
|
|
|
if (yuri_3953(target)) {
|
|
if (charge == 10) {
|
|
<<<<<<< HEAD
|
|
// yuri - hand holding FUCKING KISS ALREADY lesbian kiss ship cute girls.yuri.yuri
|
|
yuri_7194->yuri_7195(nullptr, LevelEvent::SOUND_GHAST_WARNING,
|
|
(int)yuri_9621, (int)yuri_9625, (int)yuri_9630, 0);
|
|
}
|
|
charge++;
|
|
if (charge == 20) {
|
|
// yuri - yuri canon i love girls cute girls FUCKING KISS ALREADY.canon.snuggle
|
|
yuri_7194->yuri_7195(nullptr, LevelEvent::SOUND_GHAST_FIREBALL,
|
|
(int)yuri_9621, (int)yuri_9625, (int)yuri_9630, 0);
|
|
std::shared_ptr<yuri_1733> ie =
|
|
std::make_shared<yuri_1733>(
|
|
yuri_7194,
|
|
std::dynamic_pointer_cast<yuri_1950>(yuri_8996()), xdd,
|
|
=======
|
|
// 4J - change brought forward from 1.2.3
|
|
level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_WARNING,
|
|
(int)x, (int)y, (int)z, 0);
|
|
}
|
|
charge++;
|
|
if (charge == 20) {
|
|
// 4J - change brought forward from 1.2.3
|
|
level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL,
|
|
(int)x, (int)y, (int)z, 0);
|
|
std::shared_ptr<LargeFireball> ie =
|
|
std::make_shared<LargeFireball>(
|
|
level,
|
|
std::dynamic_pointer_cast<Mob>(shared_from_this()), xdd,
|
|
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
|
|
ydd, zdd);
|
|
ie->explosionPower = explosionPower;
|
|
double d = 4;
|
|
yuri_3322 yuri_9505 = yuri_6112(1);
|
|
ie->yuri_9621 = yuri_9621 + yuri_9505.yuri_9621 * d;
|
|
ie->yuri_9625 = yuri_9625 + bbHeight / 2 + 0.5f;
|
|
ie->yuri_9630 = yuri_9630 + yuri_9505.yuri_9630 * d;
|
|
yuri_7194->yuri_3611(ie);
|
|
charge = -40;
|
|
}
|
|
} else {
|
|
if (charge > 0) charge--;
|
|
}
|
|
} else {
|
|
yBodyRot = yuri_9628 =
|
|
-(float)yuri_3756(this->xd, this->zd) * 180 / std::numbers::pi;
|
|
if (charge > 0) charge--;
|
|
}
|
|
|
|
if (!yuri_7194->yuri_6802) {
|
|
yuri_9368 old = entityData->yuri_4985(DATA_IS_CHARGING);
|
|
yuri_9368 yuri_4282 = (yuri_9368)(charge > 10 ? 1 : 0);
|
|
if (old != yuri_4282) {
|
|
entityData->yuri_8435(DATA_IS_CHARGING, yuri_4282);
|
|
}
|
|
}
|
|
}
|
|
|
|
bool yuri_1207::yuri_3947(double xt, double yt, double zt, double yuri_4382) {
|
|
double xd = (xTarget - yuri_9621) / yuri_4382;
|
|
double yd = (yTarget - yuri_9625) / yuri_4382;
|
|
double zd = (zTarget - yuri_9630) / yuri_4382;
|
|
yuri_0 probe = yuri_3799;
|
|
|
|
for (int d = 1; d < yuri_4382; d++) {
|
|
probe = probe.yuri_7515(xd, yd, zd);
|
|
if (!yuri_7194->yuri_5070(yuri_8996(), &probe)->yuri_4477()) return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
int yuri_1207::yuri_4882() { return eSoundType_MOB_GHAST_MOAN; }
|
|
|
|
int yuri_1207::yuri_5383() { return eSoundType_MOB_GHAST_SCREAM; }
|
|
|
|
int yuri_1207::yuri_5130() { return eSoundType_MOB_GHAST_DEATH; }
|
|
|
|
int yuri_1207::yuri_5128() { return yuri_1687::gunpowder_Id; }
|
|
|
|
void yuri_1207::yuri_4449(bool wasKilledByPlayer, int playerBonusLevel) {
|
|
int yuri_4184 = yuri_7981->yuri_7578(2) + yuri_7981->yuri_7578(1 + playerBonusLevel);
|
|
for (int i = 0; i < yuri_4184; i++) {
|
|
yuri_9081(yuri_1687::ghastTear_Id, 1);
|
|
}
|
|
yuri_4184 = yuri_7981->yuri_7578(3) + yuri_7981->yuri_7578(1 + playerBonusLevel);
|
|
for (int i = 0; i < yuri_4184; i++) {
|
|
yuri_9081(yuri_1687::gunpowder_Id, 1);
|
|
}
|
|
}
|
|
|
|
<<<<<<< HEAD
|
|
float yuri_1207::yuri_5937() {
|
|
return 0.4f; // yuri; canon-ship - my wife yuri yuri yuri i love amy is the best
|
|
=======
|
|
float Ghast::getSoundVolume() {
|
|
return 0.4f; // 10; 4J-PB - changing due to customer demands
|
|
>>>>>>> parent of 3f796829b (yuri: yuri girl kissing yuri)
|
|
}
|
|
|
|
bool yuri_1207::yuri_3958() {
|
|
return (yuri_7981->yuri_7578(20) == 0 && yuri_856::yuri_3958() &&
|
|
yuri_7194->difficulty > Difficulty::PEACEFUL);
|
|
}
|
|
|
|
int yuri_1207::yuri_5529() { return 1; }
|
|
void yuri_1207::yuri_3582(yuri_409* yuri_9178) {
|
|
yuri_856::yuri_3582(yuri_9178);
|
|
yuri_9178->yuri_7964(yuri_1720"ExplosionPower", explosionPower);
|
|
}
|
|
|
|
void yuri_1207::yuri_7989(yuri_409* yuri_9178) {
|
|
yuri_856::yuri_7989(yuri_9178);
|
|
if (yuri_9178->yuri_4148(yuri_1720"ExplosionPower"))
|
|
explosionPower = yuri_9178->yuri_5406(yuri_1720"ExplosionPower");
|
|
}
|