private IEnumerator HandleSwing(PlayerController user, Vector2 aimVec, float rayDamage, float rayLength) { float elapsed = 0f; while (elapsed < .1) { elapsed += BraveTime.DeltaTime; SpeculativeRigidbody hitRigidbody = this.IterativeRaycast(user.CenterPosition, aimVec, rayLength, int.MaxValue, user.specRigidbody); if (hitRigidbody && hitRigidbody.aiActor && !hitRigidbody.aiActor.healthHaver.IsBoss && hitRigidbody.aiActor.IsNormalEnemy) { hitRigidbody.aiActor.healthHaver.ApplyDamage(rayDamage, aimVec, "Hero's Sword", CoreDamageTypes.None, DamageCategory.Normal, false, null, false); user.IsEthereal = true; user.SetIsStealthed(true, "cause they just are"); PassiveItem.IncrementFlag(user, typeof(LiveAmmoItem)); if (modifierController == 0) { user.MovementModifiers += this.NoMotionModifier; user.IsStationary = true; modifierController++; } user.CurrentStoneGunTimer = 9999999f; this.LastOwner.stats.RecalculateStats(LastOwner, true); host = hitRigidbody.aiActor; vangaurd = true; MindControlEffect orAddComponent = host.gameObject.GetOrAddComponent <MindControlEffect>(); orAddComponent.owner = user; host.CompanionOwner = user; host.aiActor.SetAIMovementContribution(Vector2.zero); host.BaseMovementSpeed = 15; host.IsWorthShootingAt = true; host.IgnoreForRoomClear = true; host.HitByEnemyBullets = true; host.UniquePlayerTargetFlag = true; CompanionisedEnemyBulletModifiers friend = host.gameObject.GetOrAddComponent <CompanionisedEnemyBulletModifiers>(); friend.Start(); host.Update(); TargetNumber1(host, user); CamToggle = 1; } yield return(null); } yield break; }
public void knightPlacer(PlayerController owner) { IntVector2 aim = Vector2Extensions.ToIntVector2(owner.unadjustedAimPoint, VectorConversions.Round); RoomHandler room = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(aim); if (room != null && room == owner.CurrentRoom && owner.IsInCombat) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("ec8ea75b557d4e7b8ceeaacdf6f8238c"); AIActor aiActor = AIActor.Spawn(orLoadByGuid.aiActor, owner.CenterPosition, room, true, AIActor.AwakenAnimationType.Spawn, true); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiActor.specRigidbody, null, false); aiActor.CanTargetEnemies = true; aiActor.CanTargetPlayers = false; aiActor.IsHarmlessEnemy = true; aiActor.CanDropCurrency = false; aiActor.IgnoreForRoomClear = true; aiActor.MovementSpeed = 6.1f; aiActor.CompanionOwner = owner; aiActor.IsBuffEnemy = true; aiActor.isPassable = true; aiActor.gameObject.AddComponent <KillOnRoomClear>(); aiActor.reinforceType = AIActor.ReinforceType.Instant; aiActor.HandleReinforcementFallIntoRoom(.1f); nut = aiActor; MindControlEffect mindControl = aiActor.gameObject.GetOrAddComponent <MindControlEffect>(); mindControl.owner = (this.gun.CurrentOwner as PlayerController); aiActor.aiShooter.IsReallyBigBoy = true; aiActor.aiShooter.customShootCooldownPeriod = .25f; aiActor.Update(); if (nut.bulletBank != null) { AIBulletBank bulletBank = nut.bulletBank; bulletBank.OnProjectileCreated = (Action <Projectile>)Delegate.Combine(bulletBank.OnProjectileCreated, new Action <Projectile>(CopperChariot.OnPostProcessProjectile)); } if (nut.aiShooter != null) { AIShooter aiShooter = nut.aiShooter; aiShooter.PostProcessProjectile = (Action <Projectile>)Delegate.Combine(aiShooter.PostProcessProjectile, new Action <Projectile>(CopperChariot.OnPostProcessProjectile)); } } }