Mercurial > mm7
comparison Player.cpp @ 1362:d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
author | Grumpy7 |
---|---|
date | Mon, 15 Jul 2013 00:42:50 +0200 |
parents | b3ac17fd12de |
children | fd661c9e7f97 |
comparison
equal
deleted
inserted
replaced
1361:b3ac17fd12de | 1362:d6cf8ead9242 |
---|---|
661 | 661 |
662 | 662 |
663 //----- (00492C0B) -------------------------------------------------------- | 663 //----- (00492C0B) -------------------------------------------------------- |
664 bool Player::CanAct() | 664 bool Player::CanAct() |
665 { | 665 { |
666 if ( this->pConditions[Condition_Sleep] || this->pConditions[Condition_Paralyzed] || | 666 if ( this->IsAsleep() || this->IsParalyzed() || |
667 this->pConditions[Condition_Unconcious] || this->pConditions[Condition_Dead] || | 667 this->IsUnconcious() || this->IsDead() || |
668 this->pConditions[Condition_Pertified] || this->pConditions[Condition_Eradicated] ) | 668 this->IsPertified() || this->IsEradicated() ) |
669 return false; | 669 return false; |
670 else | 670 else |
671 return true; | 671 return true; |
672 } | 672 } |
673 | 673 |
706 int players_before; // [sp+10h] [bp-4h]@2 | 706 int players_before; // [sp+10h] [bp-4h]@2 |
707 int players_after; // [sp+20h] [bp+Ch]@82 | 707 int players_after; // [sp+20h] [bp+Ch]@82 |
708 | 708 |
709 if ( pConditions[uConditionIdx] ) | 709 if ( pConditions[uConditionIdx] ) |
710 return; | 710 return; |
711 | |
712 players_before = 0; | |
713 | |
714 for (int i = 1; i < 5; ++i) | |
715 { | |
716 if ( pPlayers[i]->CanAct() ) | |
717 ++players_before; | |
718 } | |
719 | 711 |
720 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3)) | 712 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3)) |
721 { | 713 { |
722 return; | 714 return; |
723 } | 715 } |
748 sHealth = 0; | 740 sHealth = 0; |
749 if ( sMana > 0 ) | 741 if ( sMana > 0 ) |
750 sMana = 0; | 742 sMana = 0; |
751 break; | 743 break; |
752 case Condition_Pertified: | 744 case Condition_Pertified: |
753 PlaySound((PlayerSpeech)34, 0); | 745 PlaySound(SPEECH_34, 0); |
754 break; | 746 break; |
755 case Condition_Eradicated: | 747 case Condition_Eradicated: |
756 PlaySound(SPEECH_35, 0); | 748 PlaySound(SPEECH_35, 0); |
757 if (sHealth > 0 ) | 749 if (sHealth > 0 ) |
758 sHealth = 0; | 750 sHealth = 0; |
759 if ( sMana > 0 ) | 751 if ( sMana > 0 ) |
760 sMana = 0; | 752 sMana = 0; |
761 break; | 753 break; |
762 case Condition_Zombie: | 754 case Condition_Zombie: |
763 if ( classType == PLAYER_CLASS_LICH || Eradicated() || Zombie() || !Dead()) | 755 if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead()) |
764 return; | 756 return; |
765 memset(&pConditions[0], 0, sizeof(pConditions)); | 757 memset(&pConditions[0], 0, sizeof(pConditions)); |
766 sHealth = GetMaxHealth(); | 758 sHealth = GetMaxHealth(); |
767 sMana = 0; | 759 sMana = 0; |
768 player_sex = 0; | 760 player_sex = 0; |
780 } | 772 } |
781 PlaySound(SPEECH_99, 0); | 773 PlaySound(SPEECH_99, 0); |
782 break; | 774 break; |
783 } | 775 } |
784 | 776 |
777 players_before = 0; | |
778 for (int i = 1; i < 5; ++i) | |
779 { | |
780 if ( pPlayers[i]->CanAct() ) | |
781 ++players_before; | |
782 } | |
783 | |
784 pConditions[uConditionIdx] = 1; | |
785 | |
785 remainig_player = 0; | 786 remainig_player = 0; |
786 pConditions[uConditionIdx] = 1; | |
787 players_after = 0; | 787 players_after = 0; |
788 for (int i = 1; i < 5; ++i) | 788 for (int i = 1; i < 5; ++i) |
789 { | 789 { |
790 if ( pPlayers[i]->CanAct() ) | 790 if ( pPlayers[i]->CanAct() ) |
791 { | 791 { |
9778 } | 9778 } |
9779 } | 9779 } |
9780 } | 9780 } |
9781 | 9781 |
9782 | 9782 |
9783 bool Player::Weak() | 9783 bool Player::IsWeak() |
9784 { | 9784 { |
9785 return pConditions[Condition_Weak] != 0; | 9785 return pConditions[Condition_Weak] != 0; |
9786 } | 9786 } |
9787 | 9787 |
9788 bool Player::Dead() | 9788 bool Player::IsDead() |
9789 { | 9789 { |
9790 return pConditions[Condition_Dead] != 0; | 9790 return pConditions[Condition_Dead] != 0; |
9791 } | 9791 } |
9792 | 9792 |
9793 bool Player::Eradicated() | 9793 bool Player::IsEradicated() |
9794 { | 9794 { |
9795 return pConditions[Condition_Eradicated] != 0; | 9795 return pConditions[Condition_Eradicated] != 0; |
9796 } | 9796 } |
9797 | 9797 |
9798 bool Player::Zombie() | 9798 bool Player::IsZombie() |
9799 { | 9799 { |
9800 return pConditions[Condition_Zombie] != 0; | 9800 return pConditions[Condition_Zombie] != 0; |
9801 } | 9801 } |
9802 | 9802 |
9803 bool Player::Cursed() | 9803 bool Player::IsCursed() |
9804 { | 9804 { |
9805 return pConditions[Condition_Cursed] != 0; | 9805 return pConditions[Condition_Cursed] != 0; |
9806 } | 9806 } |
9807 | 9807 |
9808 bool Player::Pertified() | 9808 bool Player::IsPertified() |
9809 { | 9809 { |
9810 return pConditions[Condition_Pertified] != 0; | 9810 return pConditions[Condition_Pertified] != 0; |
9811 } | 9811 } |
9812 | 9812 |
9813 bool Player::Unconcious() | 9813 bool Player::IsUnconcious() |
9814 { | 9814 { |
9815 return pConditions[Condition_Unconcious] != 0; | 9815 return pConditions[Condition_Unconcious] != 0; |
9816 } | 9816 } |
9817 | 9817 |
9818 bool Player::IsAsleep() | |
9819 { | |
9820 return pConditions[Condition_Sleep] != 0; | |
9821 } | |
9822 | |
9823 bool Player::IsParalyzed() | |
9824 { | |
9825 return pConditions[Condition_Paralyzed] != 0; | |
9826 } | |
9827 | |
9818 void Player::SetCursed( bool state ) | 9828 void Player::SetCursed( bool state ) |
9819 { | 9829 { |
9820 pConditions[Condition_Cursed] = state; | 9830 pConditions[Condition_Cursed] = state; |
9821 } | 9831 } |
9822 | 9832 |