diff --git a/Content/MainMenu/MainMenuLevel.umap b/Content/MainMenu/MainMenuLevel.umap index ffd179c..1e37f74 100644 Binary files a/Content/MainMenu/MainMenuLevel.umap and b/Content/MainMenu/MainMenuLevel.umap differ diff --git a/Content/Troopers/TrooperSkeletonMelee.uasset b/Content/Troopers/TrooperSkeletonMelee.uasset index 1b5a4c6..01271b7 100644 Binary files a/Content/Troopers/TrooperSkeletonMelee.uasset and b/Content/Troopers/TrooperSkeletonMelee.uasset differ diff --git a/Content/Troopers/TrooperWizard.uasset b/Content/Troopers/TrooperWizard.uasset index fee6f8c..5600e66 100644 Binary files a/Content/Troopers/TrooperWizard.uasset and b/Content/Troopers/TrooperWizard.uasset differ diff --git a/Content/Troopers/projectiles/BP_HealingProjectile.uasset b/Content/Troopers/projectiles/BP_HealingProjectile.uasset new file mode 100644 index 0000000..d6b8ea9 Binary files /dev/null and b/Content/Troopers/projectiles/BP_HealingProjectile.uasset differ diff --git a/Content/Troopers/projectiles/Materials/Healing_Material.uasset b/Content/Troopers/projectiles/Materials/Healing_Material.uasset new file mode 100644 index 0000000..401feea Binary files /dev/null and b/Content/Troopers/projectiles/Materials/Healing_Material.uasset differ diff --git a/Source/TurnBasedTutorial/BattleMode/Trooper/Projectile.cpp b/Source/TurnBasedTutorial/BattleMode/Trooper/Projectile.cpp index f05d525..d7de913 100644 --- a/Source/TurnBasedTutorial/BattleMode/Trooper/Projectile.cpp +++ b/Source/TurnBasedTutorial/BattleMode/Trooper/Projectile.cpp @@ -42,8 +42,8 @@ AProjectile::AProjectile() { } void AProjectile::Initialize(const UAbility *Ability, - uint8 playerIndex, - float PathLength) { + uint8 playerIndex, + float PathLength) { ProjectileMovementComponent->InitialSpeed = ProjectileMovementComponent->MaxSpeed = Ability->Speed; Damage = Ability->Damage; @@ -69,9 +69,16 @@ void AProjectile::NotifyActorBeginOverlap(AActor *OtherActor) { ), OtherTrooper->GetId(), OtherTrooper->GetPlayerIndex(), Damage, PlayerIndex); - if (PlayerIndex != -1 && PlayerIndex != OtherTrooper-> - GetPlayerIndex()) { - OtherTrooper->TrooperTakeDamage(Damage); + if (Damage > 0) { + if (PlayerIndex != -1 && PlayerIndex != OtherTrooper-> + GetPlayerIndex()) { + OtherTrooper->TrooperTakeDamage(Damage); + } + } else { + if (PlayerIndex != -1 && PlayerIndex == OtherTrooper-> + GetPlayerIndex()) { + OtherTrooper->TrooperTakeDamage(Damage); + } } } else { UE_LOG(LogTemp, Warning, TEXT("Overlapped not a trooper")); diff --git a/Source/TurnBasedTutorial/BattleMode/Trooper/Trooper.cpp b/Source/TurnBasedTutorial/BattleMode/Trooper/Trooper.cpp index d0f1809..221a26e 100644 --- a/Source/TurnBasedTutorial/BattleMode/Trooper/Trooper.cpp +++ b/Source/TurnBasedTutorial/BattleMode/Trooper/Trooper.cpp @@ -308,15 +308,20 @@ void ATrooper::TrooperTakeDamage_Implementation(float Damage) { if (bIsTakingDamage || bIsDead) { return; } - HitPoints = FMath::Max(0, HitPoints - Damage); - if (HitPoints == 0) { - bIsDead = true; - SetLifeSpan(DyingAnimationDuration); - GetWorld()->GetGameState()->DecreaseLivingTroopers( - PlayerIndex); + if (Damage > 0) { + HitPoints = FMath::Max(0, HitPoints - Damage); + if (HitPoints == 0) { + bIsDead = true; + SetLifeSpan(DyingAnimationDuration); + GetWorld()->GetGameState()-> + DecreaseLivingTroopers( + PlayerIndex); + } else { + // bIsTakingDamage = true; + SetIsTakingDamage(true); + } } else { - // bIsTakingDamage = true; - SetIsTakingDamage(true); + HitPoints = FMath::Min(StartHitPoints, HitPoints - Damage); } }