[ 1549137 ] Technique cutthroat is effective to no-head monster

View: New views
4 Messages — Rating Filter:   Alert me  

[ 1549137 ] Technique cutthroat is effective to no-head monster

by likeyou dontknow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I was working on a this (http://sourceforge.net/tracker/index.php?func=detail&aid=1549137&group_id=9746&atid=109746) bug and I think I have fixed it. Ali suggested that I change the bit where it uses "You(can't..." to "You_cant(..." I couldn't find where the functions were defined so I just kind of guessed on that bit, but it all seems to work. Here is the output of "diff -u" on the original file and the one I modified:

--- slashem-0.0.8E0/src/tech.c  2005-07-02 00:31:37.000000000 -0700
+++ ./tech.c    2006-11-26 22:03:38.000000000 -0800
@@ -824,18 +824,21 @@
                        if (!DEADMONSTER(mtmp) && mtmp->mhp < oldhp) {
                                int tmp = 0;
                                if (!has_head(mtmp->data) || u.uswallow) {
-                                       You("can't perform cutthroat on %s!",mon_nam(mtmp));
+                                       You_cant("perform cutthroat on %s!",mon_nam(mtmp));
                                }
-                               if (rn2(5) < (techlev(tech_no)/10 + 1)) {
+                               else if (rn2(5) < (techlev(tech_no)/10 + 1)) {
                                        You("sever %s head!", s_suffix(mon_nam(mtmp)));
                                        tmp = mtmp->mhp;
+                                       tmp += techlev(tech_no);
+                                       t_timeout = rn1(1000,500);
+                                       hurtmon(mtmp, tmp);
                                } else {
                                        You("hurt %s badly!", s_suffix(mon_nam(mtmp)));
                                        tmp = mtmp->mhp / 2;
+                                       tmp += techlev(tech_no);
+                                       t_timeout = rn1(1000,500);
+                                       hurtmon(mtmp, tmp);
                                }
-                               tmp += techlev(tech_no);
-                               t_timeout = rn1(1000,500);
-                               hurtmon(mtmp, tmp);
                        }
                }
                break;


the original file was from the se008e0.tar.gz file. I couldn't figure out how to get the CVS version, sorry that I am new to all of this stuff. Anyways, I hope the patch is helpful, and that I am going through the process of submitting it correctly enough to be understandable.

Thanks,
Michael DiPietro


Want to start your own business? Learn how on Yahoo! Small Business.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Slashem-devel mailing list
Slashem-devel@...
https://lists.sourceforge.net/lists/listinfo/slashem-devel

Re: [ 1549137 ] Technique cutthroat is effective to no-head monster

by J. Ali Harlow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2006-11-27 06:12:24 AM, likeyou dontknow wrote:
> Hi, I was working on a this  
> (http://sourceforge.net/tracker/index.php?func=detail&aid=1549137&group_id=9746&atid=109746)
> bug and I think I have fixed it. Ali suggested that I change the bit
> where it uses "You(can't..." to "You_cant(..." I couldn't find where
> the functions were defined so I just kind of guessed on that bit, but
> it all seems to work. Here is the output of "diff -u" on the original
> file and the one I modified:

I've attached your proposed fix to the bug report. It looks like it  
would work fine, but the code duplication does seems a little  
unnecessary. I'll try and commit either it or an improved version  
before we release Slash'EM in December.

Thanks,

Ali.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Slashem-devel mailing list
Slashem-devel@...
https://lists.sourceforge.net/lists/listinfo/slashem-devel

Re: [ 1549137 ] Technique cutthroat is effective to no-head monster

by likeyou dontknow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yeah, I didn't like duplicating that bit of code at the end. I wasn't sure how I could have it fire off but only be in there once. I asked my roommate and she showed me a different way of setting up the layout (I'm still trying to learn C (and get better at coding in general), and I figured that learning by doing was my best bet, I hope that isn't frowned apon.)

--- slashem-0.0.8E0/src/tech.c  2005-07-02 00:31:37.000000000 -0700
+++ ./tech.c    2006-11-27 13:25:17.000000000 -0800
@@ -824,18 +824,19 @@
                        if (!DEADMONSTER(mtmp) && mtmp->mhp < oldhp) {
                                int tmp = 0;
                                if (!has_head(mtmp->data) || u.uswallow) {
-                                       You("can't perform cutthroat on %s!",mon_nam(mtmp));
-                               }
-                               if (rn2(5) < (techlev(tech_no)/10 + 1)) {
-                                       You("sever %s head!", s_suffix(mon_nam(mtmp)));
-                                       tmp = mtmp->mhp;
+                                       You_cant("perform cutthroat on %s!",mon_nam(mtmp));
                                } else {
-                                       You("hurt %s badly!", s_suffix(mon_nam(mtmp)));
-                                       tmp = mtmp->mhp / 2;
+                                       if (rn2(5) < (techlev(tech_no)/10 + 1)) {
+                                               You("sever %s head!", s_suffix(mon_nam(mtmp)));
+                                               tmp = mtmp->mhp;
+                                       } else {
+                                               You("hurt %s badly!", s_suffix(mon_nam(mtmp)));
+                                               tmp = mtmp->mhp / 2;
+                                       }
+                                       tmp += techlev(tech_no);
+                                       t_timeout = rn1(1000,500);
+                                       hurtmon(mtmp, tmp);
                                }
-                               tmp += techlev(tech_no);
-                               t_timeout = rn1(1000,500);
-                               hurtmon(mtmp, tmp);
                        }
                }
                break;

I tried it out, and it still seems to work to me.

Thanks,
Michael DiPietro

"J. Ali Harlow" <ali@...> wrote:
On 2006-11-27 06:12:24 AM, likeyou dontknow wrote:
> Hi, I was working on a this
> (http://sourceforge.net/tracker/index.php?func=detail&aid=1549137&group_id=9746&atid=109746)
> bug and I think I have fixed it. Ali suggested that I change the bit
> where it uses "You(can't..." to "You_cant(..." I couldn't find where
> the functions were defined so I just kind of guessed on that bit, but
> it all seems to work. Here is the output of "diff -u" on the original
> file and the one I modified:

I've attached your proposed fix to the bug report. It looks like it
would work fine, but the code duplication does seems a little
unnecessary. I'll try and commit either it or an improved version
before we release Slash'EM in December.

Thanks,

Ali.


Everyone is raving about the all-new Yahoo! Mail beta.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Slashem-devel mailing list
Slashem-devel@...
https://lists.sourceforge.net/lists/listinfo/slashem-devel

Re: [ 1549137 ] Technique cutthroat is effective to no-head monster

by J. Ali Harlow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2006-11-27 09:29:54 PM, likeyou dontknow wrote:
> Yeah, I didn't like duplicating that bit of code at the end. I wasn't
> sure how I could have it fire off but only be in there once. I asked
> my roommate and she showed me a different way of setting up the layout
> (I'm still trying to learn C (and get better at coding in general),
> and I figured that learning by doing was my best bet, I hope that
> isn't frowned apon.)

Thanks for the updated patch which I've now committed.

I'm very happy for you to learn as you go and, as long as you show that  
you've put some effort in before asking, you'll find most people are  
glad to help if you need it.

Cheers,

Ali.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Slashem-devel mailing list
Slashem-devel@...
https://lists.sourceforge.net/lists/listinfo/slashem-devel