TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ AI_019_Spears_Old()

void Terraria.Projectile.AI_019_Spears_Old ( )
inlineprivate

Definition at line 48943 of file Projectile.cs.

48944 {
48945 //IL_0018: Unknown result type (might be due to invalid IL or missing references)
48946 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
48947 //IL_0024: Unknown result type (might be due to invalid IL or missing references)
48948 //IL_006a: Unknown result type (might be due to invalid IL or missing references)
48949 //IL_0085: Unknown result type (might be due to invalid IL or missing references)
48950 //IL_097f: Unknown result type (might be due to invalid IL or missing references)
48951 //IL_0985: Unknown result type (might be due to invalid IL or missing references)
48952 //IL_0992: Unknown result type (might be due to invalid IL or missing references)
48953 //IL_0997: Unknown result type (might be due to invalid IL or missing references)
48954 //IL_099c: Unknown result type (might be due to invalid IL or missing references)
48955 //IL_0b53: Unknown result type (might be due to invalid IL or missing references)
48956 //IL_0b96: Unknown result type (might be due to invalid IL or missing references)
48957 //IL_0b9c: Unknown result type (might be due to invalid IL or missing references)
48958 //IL_0beb: Unknown result type (might be due to invalid IL or missing references)
48959 //IL_0bf1: Unknown result type (might be due to invalid IL or missing references)
48960 //IL_0bfb: Unknown result type (might be due to invalid IL or missing references)
48961 //IL_0c00: Unknown result type (might be due to invalid IL or missing references)
48962 //IL_0c24: Unknown result type (might be due to invalid IL or missing references)
48963 //IL_0c2a: Unknown result type (might be due to invalid IL or missing references)
48964 //IL_0b1b: Unknown result type (might be due to invalid IL or missing references)
48965 //IL_0b3f: Unknown result type (might be due to invalid IL or missing references)
48966 //IL_0b45: Unknown result type (might be due to invalid IL or missing references)
48967 //IL_0c89: Unknown result type (might be due to invalid IL or missing references)
48968 //IL_0cb0: Unknown result type (might be due to invalid IL or missing references)
48969 //IL_0cb6: Unknown result type (might be due to invalid IL or missing references)
48970 //IL_0cca: Unknown result type (might be due to invalid IL or missing references)
48971 //IL_0cd4: Unknown result type (might be due to invalid IL or missing references)
48972 //IL_0cd9: Unknown result type (might be due to invalid IL or missing references)
48973 //IL_0eb9: Unknown result type (might be due to invalid IL or missing references)
48974 //IL_0ebf: Unknown result type (might be due to invalid IL or missing references)
48975 //IL_0ec9: Unknown result type (might be due to invalid IL or missing references)
48976 //IL_0ece: Unknown result type (might be due to invalid IL or missing references)
48977 //IL_0f0a: Unknown result type (might be due to invalid IL or missing references)
48978 //IL_0f10: Unknown result type (might be due to invalid IL or missing references)
48979 //IL_0f47: Unknown result type (might be due to invalid IL or missing references)
48980 //IL_0f51: Unknown result type (might be due to invalid IL or missing references)
48981 //IL_0f56: Unknown result type (might be due to invalid IL or missing references)
48982 //IL_0d6f: Unknown result type (might be due to invalid IL or missing references)
48983 //IL_0dab: Unknown result type (might be due to invalid IL or missing references)
48984 //IL_0db1: Unknown result type (might be due to invalid IL or missing references)
48985 //IL_0dc8: Unknown result type (might be due to invalid IL or missing references)
48986 //IL_0dce: Unknown result type (might be due to invalid IL or missing references)
48987 //IL_0dd8: Unknown result type (might be due to invalid IL or missing references)
48988 //IL_0ddd: Unknown result type (might be due to invalid IL or missing references)
48989 //IL_0de2: Unknown result type (might be due to invalid IL or missing references)
48990 //IL_0df0: Unknown result type (might be due to invalid IL or missing references)
48991 //IL_0dfa: Unknown result type (might be due to invalid IL or missing references)
48992 //IL_0dff: Unknown result type (might be due to invalid IL or missing references)
48993 //IL_0cef: Unknown result type (might be due to invalid IL or missing references)
48994 //IL_0d16: Unknown result type (might be due to invalid IL or missing references)
48995 //IL_0d1c: Unknown result type (might be due to invalid IL or missing references)
48996 //IL_0e2a: Unknown result type (might be due to invalid IL or missing references)
48997 //IL_0e4e: Unknown result type (might be due to invalid IL or missing references)
48998 //IL_0e54: Unknown result type (might be due to invalid IL or missing references)
48999 //IL_0e6b: Unknown result type (might be due to invalid IL or missing references)
49000 //IL_0e71: Unknown result type (might be due to invalid IL or missing references)
49001 //IL_0e7b: Unknown result type (might be due to invalid IL or missing references)
49002 //IL_0e80: Unknown result type (might be due to invalid IL or missing references)
49003 //IL_0e85: Unknown result type (might be due to invalid IL or missing references)
49004 //IL_0e93: Unknown result type (might be due to invalid IL or missing references)
49005 //IL_0e9d: Unknown result type (might be due to invalid IL or missing references)
49006 //IL_0ea2: Unknown result type (might be due to invalid IL or missing references)
49007 //IL_030b: Unknown result type (might be due to invalid IL or missing references)
49008 //IL_032b: Unknown result type (might be due to invalid IL or missing references)
49009 //IL_0434: Unknown result type (might be due to invalid IL or missing references)
49010 //IL_045c: Unknown result type (might be due to invalid IL or missing references)
49011 //IL_047c: Unknown result type (might be due to invalid IL or missing references)
49012 //IL_049b: Unknown result type (might be due to invalid IL or missing references)
49013 //IL_04bd: Unknown result type (might be due to invalid IL or missing references)
49014 //IL_04dd: Unknown result type (might be due to invalid IL or missing references)
49015 //IL_072a: Unknown result type (might be due to invalid IL or missing references)
49016 //IL_0734: Unknown result type (might be due to invalid IL or missing references)
49017 //IL_0739: Unknown result type (might be due to invalid IL or missing references)
49018 //IL_0741: Unknown result type (might be due to invalid IL or missing references)
49019 //IL_0761: Unknown result type (might be due to invalid IL or missing references)
49020 //IL_0780: Unknown result type (might be due to invalid IL or missing references)
49021 //IL_0786: Unknown result type (might be due to invalid IL or missing references)
49022 Vector2 vector = Main.player[owner].RotatedRelativePoint(Main.player[owner].MountedCenter);
49023 direction = Main.player[owner].direction;
49024 Main.player[owner].heldProj = whoAmI;
49025 Main.player[owner].MatchItemTimeToItemAnimation();
49026 position.X = vector.X - (float)(width / 2);
49027 position.Y = vector.Y - (float)(height / 2);
49028 bool flag = Main.player[owner].itemAnimation < Main.player[owner].itemAnimationMax / 3;
49029 if (!Main.player[owner].frozen)
49030 {
49031 if (type == 46)
49032 {
49033 if (ai[0] == 0f)
49034 {
49035 ai[0] = 3f;
49036 netUpdate = true;
49037 }
49038 if (flag)
49039 {
49040 ai[0] -= 1.6f;
49041 }
49042 else
49043 {
49044 ai[0] += 1.4f;
49045 }
49046 }
49047 else if (type == 105)
49048 {
49049 if (ai[0] == 0f)
49050 {
49051 ai[0] = 3f;
49052 netUpdate = true;
49053 }
49054 if (flag)
49055 {
49056 ai[0] -= 2.4f;
49057 }
49058 else
49059 {
49060 ai[0] += 2.1f;
49061 }
49062 }
49063 else if (type == 367)
49064 {
49066 if (ai[0] == 0f)
49067 {
49068 ai[0] = 3f;
49069 netUpdate = true;
49070 }
49071 if (flag)
49072 {
49073 ai[0] -= 1.6f;
49074 }
49075 else
49076 {
49077 ai[0] += 1.5f;
49078 }
49079 }
49080 else if (type == 368)
49081 {
49083 if (ai[0] == 0f)
49084 {
49085 ai[0] = 3f;
49086 netUpdate = true;
49087 }
49088 if (flag)
49089 {
49090 ai[0] -= 1.5f;
49091 }
49092 else
49093 {
49094 ai[0] += 1.4f;
49095 }
49096 }
49097 else if (type == 222)
49098 {
49099 if (ai[0] == 0f)
49100 {
49101 ai[0] = 3f;
49102 netUpdate = true;
49103 }
49104 if (flag)
49105 {
49106 ai[0] -= 2.4f;
49107 if (localAI[0] == 0f && Main.myPlayer == owner)
49108 {
49109 localAI[0] = 1f;
49110 NewProjectile(GetProjectileSource_FromThis(), base.Center.X + velocity.X * ai[0], base.Center.Y + velocity.Y * ai[0], velocity.X, velocity.Y, 228, damage, knockBack, owner);
49111 }
49112 }
49113 else
49114 {
49115 ai[0] += 2.1f;
49116 }
49117 }
49118 else if (type == 342)
49119 {
49120 if (ai[0] == 0f)
49121 {
49122 ai[0] = 3f;
49123 netUpdate = true;
49124 }
49125 if (flag)
49126 {
49127 ai[0] -= 2.4f;
49128 if (localAI[0] == 0f && Main.myPlayer == owner)
49129 {
49130 localAI[0] = 1f;
49131 if (Collision.CanHit(Main.player[owner].position, Main.player[owner].width, Main.player[owner].height, new Vector2(base.Center.X + velocity.X * ai[0], base.Center.Y + velocity.Y * ai[0]), width, height))
49132 {
49133 NewProjectile(GetProjectileSource_FromThis(), base.Center.X + velocity.X * ai[0], base.Center.Y + velocity.Y * ai[0], velocity.X * 2.4f, velocity.Y * 2.4f, 343, (int)((double)damage * 0.8), knockBack * 0.85f, owner);
49134 }
49135 }
49136 }
49137 else
49138 {
49139 ai[0] += 2.1f;
49140 }
49141 }
49142 else if (type == 47)
49143 {
49144 if (ai[0] == 0f)
49145 {
49146 ai[0] = 4f;
49147 netUpdate = true;
49148 }
49149 if (flag)
49150 {
49151 ai[0] -= 1.2f;
49152 }
49153 else
49154 {
49155 ai[0] += 0.9f;
49156 }
49157 }
49158 else if (type == 153)
49159 {
49161 if (ai[0] == 0f)
49162 {
49163 ai[0] = 4f;
49164 netUpdate = true;
49165 }
49166 if (flag)
49167 {
49168 ai[0] -= 1.5f;
49169 }
49170 else
49171 {
49172 ai[0] += 1.3f;
49173 }
49174 }
49175 else if (type == 49)
49176 {
49177 if (ai[0] == 0f)
49178 {
49179 ai[0] = 4f;
49180 netUpdate = true;
49181 }
49182 if (flag)
49183 {
49184 ai[0] -= 1.1f;
49185 }
49186 else
49187 {
49188 ai[0] += 0.85f;
49189 }
49190 }
49191 else if (type == 730)
49192 {
49194 if (ai[0] == 0f)
49195 {
49196 ai[0] = 8f;
49197 netUpdate = true;
49198 if (localAI[0] == 0f && Main.myPlayer == owner)
49199 {
49200 localAI[0] = 1f;
49201 Vector2 vector2 = velocity * 4f;
49202 NewProjectile(GetProjectileSource_FromThis(), base.Center.X + velocity.X * ai[0], base.Center.Y + velocity.Y * ai[0], vector2.X, vector2.Y, 732, (int)((double)damage * 1.25), knockBack * 0.5f, owner);
49203 }
49204 }
49205 if (flag)
49206 {
49207 ai[0] -= 1.5f;
49208 }
49209 else
49210 {
49211 ai[0] += 1.2f;
49212 }
49213 }
49214 else if (type == 64 || type == 215)
49215 {
49217 if (ai[0] == 0f)
49218 {
49219 ai[0] = 3f;
49220 netUpdate = true;
49221 }
49222 if (flag)
49223 {
49224 ai[0] -= 1.9f;
49225 }
49226 else
49227 {
49228 ai[0] += 1.7f;
49229 }
49230 }
49231 else if (type == 66 || type == 97 || type == 212 || type == 218)
49232 {
49234 if (ai[0] == 0f)
49235 {
49236 ai[0] = 3f;
49237 netUpdate = true;
49238 }
49239 if (flag)
49240 {
49241 ai[0] -= 2.1f;
49242 }
49243 else
49244 {
49245 ai[0] += 1.9f;
49246 }
49247 }
49248 else if (type == 130)
49249 {
49251 if (ai[0] == 0f)
49252 {
49253 ai[0] = 3f;
49254 netUpdate = true;
49255 }
49256 if (flag)
49257 {
49258 ai[0] -= 1.3f;
49259 }
49260 else
49261 {
49262 ai[0] += 1f;
49263 }
49264 }
49265 }
49266 position += velocity * ai[0];
49267 if (type == 130)
49268 {
49269 if (ai[1] == 0f || ai[1] == 4f || ai[1] == 8f || ai[1] == 12f || ai[1] == 16f || ai[1] == 20f || ai[1] == 24f)
49270 {
49271 NewProjectile(GetProjectileSource_FromThis(), position.X + (float)(width / 2), position.Y + (float)(height / 2), velocity.X, velocity.Y, 131, damage / 3, 0f, owner);
49272 }
49273 ai[1] += 1f;
49274 }
49275 if (Main.player[owner].ItemAnimationEndingOrEnded)
49276 {
49277 Kill();
49278 }
49279 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 2.355f;
49280 if (spriteDirection == -1)
49281 {
49282 rotation -= 1.57f;
49283 }
49284 if (type == 46)
49285 {
49286 if (Main.rand.Next(5) == 0)
49287 {
49288 Dust.NewDust(position, width, height, 14, 0f, 0f, 150, default(Color), 1.4f);
49289 }
49290 int num = Dust.NewDust(position, width, height, 27, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.2f);
49291 Main.dust[num].noGravity = true;
49292 Main.dust[num].velocity.X /= 2f;
49293 Main.dust[num].velocity.Y /= 2f;
49294 num = Dust.NewDust(position - velocity * 2f, width, height, 27, 0f, 0f, 150, default(Color), 1.4f);
49295 Main.dust[num].velocity.X /= 5f;
49296 Main.dust[num].velocity.Y /= 5f;
49297 }
49298 if (type == 730)
49299 {
49300 if (Main.rand.Next(5) == 0)
49301 {
49302 Dust dust = Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 150, default(Color), 0.7f);
49303 dust.noGravity = true;
49304 dust.velocity *= 1.4f;
49305 }
49306 if (Main.rand.Next(5) == 0)
49307 {
49308 Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 150, default(Color), 0.5f).velocity.Y -= 0.5f;
49309 }
49310 }
49311 else if (type == 105)
49312 {
49313 if (Main.rand.Next(3) == 0)
49314 {
49315 int num2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 57, velocity.X * 0.2f, velocity.Y * 0.2f, 200, default(Color), 1.2f);
49316 Dust obj = Main.dust[num2];
49317 obj.velocity += velocity * 0.3f;
49318 Dust obj2 = Main.dust[num2];
49319 obj2.velocity *= 0.2f;
49320 }
49321 if (Main.rand.Next(4) == 0)
49322 {
49323 int num3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 43, 0f, 0f, 254, default(Color), 0.3f);
49324 Dust obj3 = Main.dust[num3];
49325 obj3.velocity += velocity * 0.5f;
49326 Dust obj4 = Main.dust[num3];
49327 obj4.velocity *= 0.5f;
49328 }
49329 }
49330 else if (type == 153)
49331 {
49332 int num4 = Dust.NewDust(position - velocity * 3f, width, height, 115, velocity.X * 0.4f, velocity.Y * 0.4f, 140);
49333 Main.dust[num4].noGravity = true;
49334 Main.dust[num4].fadeIn = 1.25f;
49335 Dust obj5 = Main.dust[num4];
49336 obj5.velocity *= 0.25f;
49337 }
49338 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
int damage
This will always be set in Projectile.NewProjectile based on the weapons damage and player stat modif...
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
bool netUpdate
Set manually to true in M:Terraria.ModLoader.ModProjectile.AI once to make it sync its current F:Terr...
IEntitySource GetProjectileSource_FromThis()
float[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T:Terraria....
float knockBack
This will always be set in Projectile.NewProjectile based on the weapons knockback and player stat mo...
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position and...

References Terraria.Collision.CanHit(), Terraria.Main.dust, Terraria.Main.myPlayer, Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Main.player, and Terraria.Main.rand.

+ Here is the call graph for this function: