-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagicParadeInfo.cpp
More file actions
36 lines (29 loc) · 1.32 KB
/
MagicParadeInfo.cpp
File metadata and controls
36 lines (29 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "MagicParadeInfo.h"
void MagicParadeInfo::CastSpell() {
Entity Defender = this->Defender;
Entity Target = this->Attacker;
if (!Defender.NPC.IsValid()) {
return;
}
if (!Target.NPC.IsValid()) {
return;
}
bCMatrix Pose = Defender.GetPose();
Pose.AccessTranslation().AccessY() += 130;
Entity Spell = Template(this->Spell);
Entity Spawn = Spell.Magic.GetSpawn();
Entity SpawnedEntity = Spawn.Spawn(Spawn.GetTemplate(), Pose);
SpawnedEntity.Interaction.SetOwner(Defender);
SpawnedEntity.Interaction.SetSpell(Spell);
SpawnedEntity.EnableCollisionWith(SpawnedEntity, GEFalse);
SpawnedEntity.EnableCollisionWith(Defender, GEFalse);
bCVector Vec = Pose.AccessZAxis();
Vec.AccessY() += 0.01;
Vec.Normalize();
SpawnedEntity.CollisionShape.CreateShape(eECollisionShapeType_Point, eEShapeGroup_Projectile, bCVector(0, 0, 0), bCVector(0, 0, 0));
SpawnedEntity.Projectile.SetTarget(Target);
SpawnedEntity.Projectile.AccessProperty<PSProjectile::PropertyPathStyle>() = gEProjectilePath_Missile;
SpawnedEntity.Projectile.AccessProperty<PSProjectile::PropertyTargetDirection>() = Vec;
SpawnedEntity.Damage.AccessProperty<PSDamage::PropertyManaUsed>() = Spell.Magic.GetProperty<PSMagic::PropertyMaxManaCost>();
SpawnedEntity.Projectile.Shoot();
}