⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 一个采用类似大富翁游戏模式的背单词软件
💻 PAS
📖 第 1 页 / 共 5 页
字号:

   computer_step; //电脑走一步
 show_cup; //检查奖杯状态
end;

procedure TForm1.RadioButton2Click(Sender: TObject);
begin
if RadioButton2.Checked then
check_asw(1);
end;

procedure TForm1.RadioButton3Click(Sender: TObject);
begin
 if RadioButton3.Checked then
  check_asw(2);
end;

procedure TForm1.prs_game_list2(const s: string);
var i: integer;
begin

 if pos('加',s)> 0 then
  begin
   if not TryStrToInt(copy(s,pos('加',s)+2,9),i) then
    i:= 0;
   jit_caifu:= jit_caifu + i;
   if checkbox7.Checked then
   PlaySound(pchar(extractfilepath(application.ExeName)+'Chimes.wav'),0,SND_FILENAME or SND_ASYNC);
  end else if pos('减',s)> 0 then
      begin
      if not TryStrToInt(copy(s,pos('减',s)+2,9),i) then
         i:= 0;
       jit_caifu:= jit_caifu -i;
      end else if pos('进',s)> 0 then
            begin
            if not TryStrToInt(copy(s,pos('进',s)+2,9),i) then
               i:= 1;
               jit_dangqianbs:= jit_dangqianbs + i;

              show_game_state;  //显示游戏状态
            end else if pos('退',s)> 0 then
                begin
                if not TryStrToInt(copy(s,pos('退',s)+2,9),i) then
                     i:= 1;
                   jit_dangqianbs:= jit_dangqianbs -i;

                  show_game_state;  //显示游戏状态
                end;
end;

procedure TForm1.computer_step;

  var ss: string;
begin
    if not groupbox4.Visible then
     begin
   jit_dangqianbs_dn:= jit_dangqianbs_dn mod listbox2.Items.Count;
     prs_game_list2_dn(listbox2.Items.Strings[jit_dangqianbs_dn]); //处理游戏进程
     end;

    case jit_koucu_dn of
  0..10000: ss:= '平民';
  10001..25000:ss:= '村长';
  25001..50000:ss:= '乡长';
  50001..80000: ss:= '县令';
  80001..125000:ss:= '知府';
  125001..180000:ss:= '道台';
  180001..250000:ss:= '太守';
  250001..350000:ss:= '都督';
  350001..500000:ss:= '御史';
  500001..700000:ss:= '巡按';
  700001..1000000: ss:= '宰相';
  1000001..3000000: ss:= '拜侯封王';
  3000001..6000000: ss:= '崂山寻道';
  6000001..9000000: ss:= '东渡蓬莱';
  9000001..15000000: ss:= '气贯长虹';
  15000001..20000000: ss:= '虚弥幻境';
  20000001..25000000: ss:= '天长地久';
  25000001..30000000: ss:= '偶得仙果';
  30000001..35000000: ss:= '初入仙界';
  35000001..40000000: ss:= '仙界一级';
  45000001..50000000: ss:= '仙界二级';
  55000001..60000000: ss:= '仙界三级';
  65000001..70000000: ss:= '深入仙界';
  70000001..80000000: ss:= '天人合一';
  80000001..99000000: ss:= '大功告成';
  end;

  if listbox1.Items.Count< 3 then
   begin
    listbox1.Items.Add('玩家:电脑');
    listbox1.Items.Add('头衔:'+ ss);
    listbox1.Items.Add('财富:'+FormatCurr('0.00',jit_caifu_dn));
    listbox1.Items.Add('当前步数:'+ inttostr(jit_dangqianbs_dn));
    listbox1.Items.Add(listbox2.Items.Strings[jit_dangqianbs_dn]);
   end else begin
             listbox1.Items.Strings[1]:='头衔:'+ ss;
             listbox1.Items.Strings[2]:='财富:'+FormatCurr('0.00',jit_caifu_dn);
              if groupbox4.Visible then
               begin

                listbox1.Items.Strings[4]:= '进入赌钱状态。';
               end else begin

             listbox1.Items.Strings[4]:= listbox2.Items.Strings[jit_dangqianbs_dn];
                        end;
            end;
   up_game_honor; //升级头衔
end;

procedure TForm1.prs_game_list2_dn(const s: string);
var i: integer;
begin

 if pos('加',s)> 0 then
  begin
   if not TryStrToInt(copy(s,pos('加',s)+2,9),i) then
    i:= 0;
   jit_caifu_dn:= jit_caifu_dn + i;
  end else if pos('减',s)> 0 then
      begin
      if not TryStrToInt(copy(s,pos('减',s)+2,9),i) then
         i:= 0;
       jit_caifu_dn:= jit_caifu_dn -i;
      end else if pos('进',s)> 0 then
            begin
            if not TryStrToInt(copy(s,pos('进',s)+2,9),i) then
               i:= 1;
             jit_dangqianbs_dn:= jit_dangqianbs_dn + i;
              computer_step;  //显示游戏状态
            end else if pos('退',s)> 0 then
                begin
                if not TryStrToInt(copy(s,pos('退',s)+2,9),i) then
                     i:= 1;
                 jit_dangqianbs_dn:= jit_dangqianbs_dn -i;
                  computer_step;  //显示游戏状态
                end;

end;

procedure TForm1.show_inst_game;
var ss: string;
begin
   listbox3.items[3]:= inttostr(jit_dangqianbs); //显示当前步数
 listbox3.items[2]:= FormatCurr('0.00',jit_caifu);
  case jit_koucu of
  0..10000: listbox3.items[1]:= '平民';
  10001..25000:listbox3.items[1]:= '村长';
  25001..50000:listbox3.items[1]:= '乡长';
  50001..80000: listbox3.items[1]:= '县令';
  80001..125000:listbox3.items[1]:= '知府';
  125001..180000:listbox3.items[1]:= '道台';
  180001..250000:listbox3.items[1]:= '太守';
  250001..350000:listbox3.items[1]:= '都督';
  350001..500000:listbox3.items[1]:= '御史';
  500001..700000:listbox3.items[1]:= '巡按';
  700001..1000000: listbox3.items[1]:= '宰相';
  1000001..3000000: listbox3.items[1]:= '拜侯封王';
  3000001..6000000: listbox3.items[1]:= '崂山寻道';
  6000001..9000000: listbox3.items[1]:= '东渡蓬莱';
  9000001..15000000: listbox3.items[1]:= '气贯长虹';
  15000001..20000000: listbox3.items[1]:= '虚弥幻境';
  20000001..25000000: listbox3.items[1]:= '天长地久';
  25000001..30000000: listbox3.items[1]:= '偶得仙果';
  30000001..35000000: listbox3.items[1]:= '初入仙界';
  35000001..40000000: listbox3.items[1]:= '仙界一级';
  45000001..50000000: listbox3.items[1]:= '仙界二级';
  55000001..60000000: listbox3.items[1]:= '仙界三级';
  65000001..70000000: listbox3.items[1]:= '深入仙界';
  70000001..80000000: listbox3.items[1]:= '天人合一';
  80000001..99000000: listbox3.items[1]:= '大功告成';
  end;
    case jit_koucu_dn of
  0..10000: ss:= '平民';
  10001..25000:ss:= '村长';
  25001..50000:ss:= '乡长';
  50001..80000: ss:= '县令';
  80001..125000:ss:= '知府';
  125001..180000:ss:= '道台';
  180001..250000:ss:= '太守';
  250001..350000:ss:= '都督';
  350001..500000:ss:= '御史';
  500001..700000:ss:= '巡按';
  700001..1000000: ss:= '宰相';
  1000001..3000000: ss:= '拜侯封王';
  3000001..6000000: ss:= '崂山寻道';
  6000001..9000000: ss:= '东渡蓬莱';
  9000001..15000000: ss:= '气贯长虹';
  15000001..20000000: ss:= '虚弥幻境';
  20000001..25000000: ss:= '天长地久';
  25000001..30000000: ss:= '偶得仙果';
  30000001..35000000: ss:= '初入仙界';
  35000001..40000000: ss:= '仙界一级';
  45000001..50000000: ss:= '仙界二级';
  55000001..60000000: ss:= '仙界三级';
  65000001..70000000: ss:= '深入仙界';
  70000001..80000000: ss:= '天人合一';
  80000001..99000000: ss:= '大功告成';
  end;

    if listbox1.Items.Count< 3 then
   begin
    listbox1.Items.Add('玩家:电脑');
    listbox1.Items.Add('头衔:'+ ss);
    listbox1.Items.Add('财富:'+FormatCurr('0.00',jit_caifu_dn));
    listbox1.Items.Add('当前步数:'+ inttostr(jit_dangqianbs_dn));
    listbox1.Items.Add('消息');
   end else begin
             listbox1.Items.Strings[1]:='头衔:'+ ss;
             listbox1.Items.Strings[2]:='财富:'+FormatCurr('0.00',jit_caifu_dn);
             listbox1.Items.Strings[3]:='当前步数:'+ inttostr(jit_dangqianbs_dn);
             listbox1.Items.Strings[4]:= listbox2.Items.Strings[jit_dangqianbs_dn];
            end;
end;

procedure TForm1.GroupBox3Click(Sender: TObject);
begin
 button1click(groupbox3);
end;

procedure TForm1.up_game_honor;
var i: integer;
begin
i:= 0;
  if jit_caifu > jit_koucu then
     begin
  case jit_caifu of
  10001..25000:begin
               jit_koucu:= 25000;
               i:= 1001;
               end;
  25001..50000:begin
               jit_koucu:= 50000;
               i:= 25001;
               end;
  50001..80000: begin
                jit_koucu:= 80000;
               i:= 50001;
               end;
  80001..125000:begin
                jit_koucu:= 125000;
               i:= 80001;
               end;
  125001..180000:begin
               jit_koucu:= 180000;
               i:= 125001;
               end;
  180001..250000:begin
               jit_koucu:= 250000;
               i:= 180001;
               end;
  250001..350000:begin
               jit_koucu:= 350000;
               i:= 250001;
               end;
  350001..500000:begin
               jit_koucu:= 500000;
               i:= 350001;
               end;
  500001..700000:begin
               jit_koucu:= 700000;
               i:= 500001;
               end;
  700001..1000000: begin
               jit_koucu:= 1000000;
               i:= 700001;
               end;
  1000001..3000000: begin
               jit_koucu:= 3000000;
               i:= 1000001;
               end;
  3000001..6000000: begin
               jit_koucu:= 6000000;
               i:= 3000001;
               end;
  6000001..9000000: begin
               jit_koucu:= 9000000;
               i:= 6000001;
               end;
  9000001..15000000: begin
               jit_koucu:= 15000000;
               i:= 9000001;
               end;
  15000001..20000000: begin
               jit_koucu:= 20000000;
               i:= 15000001;
               end;
  20000001..25000000: begin
               jit_koucu:= 25000000;
               i:= 20000001;
               end;
  25000001..30000000: begin
               jit_koucu:= 30000000;
               i:= 25000001;
               end;
  30000001..35000000: begin
               jit_koucu:= 35000000;
               i:= 30000001;
               end;
  35000001..40000000: begin
               jit_koucu:= 40000000;
               i:= 35000001;
               end;
  45000001..50000000: begin
               jit_koucu:= 50000000;
               i:= 45000001;
               end;
  55000001..60000000: begin
               jit_koucu:= 60000000;
               i:= 55000001;
               end;
  65000001..70000000: begin
               jit_koucu:= 70000000;
               i:= 65000001;
               end;
  70000001..80000000: begin
               jit_koucu:= 80000000;
               i:= 70000001;
               end;
  80000001..99000000: begin
               jit_koucu:= 99000000;
               i:= 80000001;
               end;
  end;
   if  (jit_koucu > 0) then
    begin
    jit_caifu:= jit_caifu-i;
    if checkbox7.Checked then
    PlaySound(pchar(extractfilepath(application.ExeName)+'Joy118.wav'),0,SND_FILENAME or SND_ASYNC);
     show_inst_game;
    end;
   end;

   if jit_caifu_dn > jit_koucu_dn then
     begin
  case jit_caifu_dn of
  10001..25000:begin
               jit_koucu_dn:= 25000;
               i:= 10001;
               end;
  25001..50000:begin
               jit_koucu_dn:= 50000;
               i:= 25001;
               end;
  50001..80000: begin
               jit_koucu_dn:= 80000;
               i:= 50001;
               end;
  80001..125000:begin
               jit_koucu_dn:= 125000;
               i:= 80001;
               end;
  125001..180000:begin
               jit_koucu_dn:= 180000;
               i:= 125001;
               end;
  180001..250000:begin
                jit_koucu_dn:= 250000;
               i:= 180001;
               end;
  250001..350000:begin
               jit_koucu_dn:= 350000;
               i:= 250001;
               end;
  350001..500000:begin
               jit_koucu_dn:= 500000;
               i:= 350001;
               end;
  500001..700000:begin
               jit_koucu_dn:= 700000;
               i:= 500001;
               end;
  700001..1000000: begin
               jit_koucu_dn:= 1000000;
               i:= 700001;
               end;
  1000001..3000000: begin
               jit_koucu_dn:= 3000000;
               i:= 1000001;
               end;
  3000001..6000000: begin
               jit_koucu_dn:= 6000000;
               i:= 3000001;
               end;
  6000001..9000000: begin
               jit_koucu_dn:= 9000000;
               i:= 6000001;
               end;
  9000001..15000000: begin
               jit_koucu_dn:= 15000000;
               i:= 9000001;
               end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -